So I am a little confused with how to set the css of an individual row in my Datagrid (which as i understand it can use everything the cellTable can use).
First I have a double click and single click handler which do get correctly called in 'onCellPreview'(had to remove selectionModel for this to work). I then can get the row number through event.getIndex().
Next is where I fail in attempt to set the CSS for the selected row, my code:
int Row= event.getIndex();
myDataTable.setRowStyles(new RowStyles<String[]>(){
@Override
public String getStyleNames(String [] rowObject, int theRow){
if (row== theRow){
return "myDataGridSelectedRow";
}
else
return "myDataGrid";
}
});
However I don't understand how this is supposed to work (which is perhaps why I can't get it to work)
- How does getStyleNames() get called? It just steps over it in my debugger.
- where should the setRowStyles method call be located in my code?
I suppose for this to work properly i must remove the call
myDataTable.setStyleName("myDataGrid");
- There is also a pre-existing css class in my DataGridOverride.css(which is different from the main css file where "myDataGrid" is located). The class is ".dataGridSelectedRowCell" and has a background color set (uses !important) but it does not work.