Smart GWT - change text color of clicked record in ListGrid

835 views Asked by At

I'm using Smart GWT version 4. I want to change the text color of selected record on record click action. I cannot find a way to do it using "setHilites" method or anything else. How can I achieve this?

2

There are 2 answers

0
Daniel Faro On BEST ANSWER

If you go by the BaseStyle way, its something like this.

    @Override
protected String getBaseStyle(ListGridRecord record, int rowNum, int colNum){

    if (listGrid.getSelectedRecord() == record){
        return "custom-color-CSS";
    }

    return super.getBaseStyle(record, rowNum, colNum);
}

}

2
claudiobosticco On

in a ListGrid.getCellCSSText or ListGrid.getBaseStyle method, you could use the ListGrid.isSelected(record) to return appropriate style.