java - GWT- CellTable--Trouble with setting row highlighting -


so little confused how set css of individual row in datagrid (which understand can use celltable can use).

first have double click , single click handler correctly called in 'oncellpreview'(had remove selectionmodel work). can row number through event.getindex().

next fail in attempt set css selected row, 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 don't understand how supposed work (which perhaps why can't work)

  1. how getstylenames() called? steps on in debugger.
  2. where should setrowstyles method call located in code?
  3. i suppose work must remove call

     mydatatable.setstylename("mydatagrid"); 
  4. there pre-existing css class in datagridoverride.css(which different main css file "mydatagrid" located). class ".datagridselectedrowcell" , has background color set (uses !important) not work.

this method setrowstyles() called when table rendered.

you can set style dynamically way:

mydatatable.getrowelement(i).getstyle()... 

or

mydatatable.getrowelement(i).setclassname("mydatagridselectedrow"); 

you not need remove style name grid.

edit:

an alternative approach override standard datagrid css resource:

how style gwt 2.1 celltables headers?

i recommend approach if want make many changes default gwt datagrid styles.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -