Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid Cell Text Value Custom Style

    Hello team,

    How is it possible to make cell value (I mean text into cell) custom style ?
    For better explanation I have some screenshots here .

    I have ListGrid with filtering. I've found example here:
    filter example

    filtering works fine (Please see screenshot Screenshot-N1).

    But I want to make filtered text highlight or make text color red or bold or simething like that.
    I want it because the cell value text is little bit large as shown in screenshots.

    my filter text value is : "პუგაჩოვა", I want to set style for this word. For example, please see Screenshot-N2.

    Of course I know I can set style for entire cell value by getCellCSSText method overriding :

    Code:
    listGrid = new ListGrid() {
    	protected String getCellCSSText(ListGridRecord record, int rowNum,
    			int colNum) {
    		ListGridRecord countryRecord = (ListGridRecord) record;
    		if (countryRecord != null) {
    			Integer note_crit = countryRecord
    					.getAttributeAsInt("note_crit");
    			if (note_crit != null && note_crit.equals(-1)
    					&& colNum == 8) {
    				return "color:red;";
    			}
    		}
    
    		if (colNum == 1) {
    			return "color:red;";
    		} else if (colNum == 4) {
    			return "color:green;";
    		} else if (colNum == 7) {
    			return "color:green;";
    		} else {
    			return super.getCellCSSText(record, rowNum, colNum);
    		}
    	};
    };
    I don't want it , I want style for concrete word , which I enter into filter.

    Is it possible ?


    My Env :
    1. SGWTEE 2.5 (Evaluation) - build Date - 2011-09-11
    2. GWT 2.3.0
    3. Firefox 5.
    4. OpenSuse 11.4
    5. jdk1.6.0_26
    6. Oracle DB 11g
    7. Eclipse Indigo (With GWT Plugin.)


    ________________________________
    Regards,
    Paata Lominadze
    Attached Files

    #2
    Is it possible ?
    or am I on wrong way ?


    _____________________________
    Regards,
    Paata Lominadze

    Comment


      #3
      use setCellStyle or
      Code:
      Use setcell formatter for particular list grid.....
      new CellFormatter() {  
                  public String format(Object value, ListGridRecord record, int rowNum,int colNum) {  
                      if(value.toString.equals("-")){
                               return "<font color = 'red'>+value+"</font>";
                         }
                  }  
              });
      Last edited by kavyabellary; 27 Sep 2011, 00:28.

      Comment

      Working...
      X