Announcement

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

    ListGrid - Customizing Cell Style with custom CSS classes, but keeping dynamic suffix

    Environement : SmartGWT/3.0p/LGPL/2012-04-30/smartgwt.jar or previous with any browser.

    As ListGrid - Customizing Cell Style - Using custom CSS classes or on demand color set of rows in smartclient(treeGrid) i try to custom Cells (is a way to custom rows ?) of my ListGrid.

    I want, colorize cells from a this formula and keep the dynamics suffixes : "Over", "Selected", "Dark", "SelectedDark", "SelectedOver", "SelectedOverDark", "Disabled", "DisabledDark"
    Code:
    CONCAT( "static_prefix_css" + ListGridRecord.attribute("myState") )
    I don't want add a special attribute for css, like is possible with
    Code:
    setRecordBaseStyleProperty("myState");
    Finally, CSS render, must change class of cells like this :

    On record with myState == 1
    myState_1
    myState_1Over
    myState_1SelectedOver
    On record with myState == 2
    myState_2
    myState_2Over
    myState_2SelectedOver
    But using the following code, class are only : myState_1 or myState_2 without dynamic state suffix presentation.

    Somebody to help/solve me ?...

    How and where is managed the dynamic class suffixes ?


    Code:
    	@Override
    	protected String getCellStyle(ListGridRecord record, int rowNum, int colNum) {
    			
    			if( record != null ) {
    				try {
    					int etat = Integer.parseInt(record.getAttribute("myState"));
    					
    					switch (etat) {
    					case 1:
    						return "myState_1";
    					case 2:
    						return "myState_2";
    					case 0:
    						return "myState_0";				
    		
    					default:
    						return super.getCellStyle(record, rowNum, colNum);
    					}			
    				} catch (NumberFormatException e) {
    				}
    			}
    			return super.getCellStyle(record, rowNum, colNum);
    		}
    		return super.getCellStyle(record, rowNum, colNum);
    	}
Working...
X