SmartGWT - Change the color of the row when clicking on a ListGrid

0

I am using a ListGrid, when the user clicks on a row I want the background color of that row to change to one chosen by me.

I add an image that shows a row with the color changed once the user has clicked.

How can I get the color to change after a click?

    
asked by Daniel Faro 04.07.2016 в 09:41
source

1 answer

0

The normal thing in these cases is to overwrite the getBaseStyle method of the ListGrid , it is done 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);
}

We must remember that what this method returns is a CSS class that must be defined somewhere.

    
answered by 04.07.2016 / 09:44
source