PDA

View Full Version : Different row styles in a grid



_bv_
3 Oct 2011, 3:14 AM
Hello everybody,
How can I make rows in the grid look different depending on some condition? I mean smth like that:

<table>
<tr class="class1">...</tr>
<tr class="class2">...</tr>
</table>

sven
3 Oct 2011, 3:20 AM
You can set a custom GridViewConfig to your GridView. In that you need to override the getRowStyle method

_bv_
3 Oct 2011, 4:12 AM
From the documentation:
getRowStyle (http://www.sencha.com/gxtdocs/codeservlet?qn=com.extjs.gxt.ui.client.widget.grid.GridViewConfig&name=GridViewConfig&line=19) ( ModelData (http://www.sencha.com/gxtdocs/#com.extjs.gxt.ui.client.widget.layout.VBoxLayout) model, int rowIndex, ListStore (http://www.sencha.com/gxtdocs/#com.extjs.gxt.ui.client.widget.layout.VBoxLayout)<ModelData> ds ) : java.lang.String Returns one to many CSS style names separated by spaces.
How should I use it? I thought I needed an opposite method, smth like setRowStyle, didn't I?

sven
3 Oct 2011, 4:21 AM
Simple extend GridViewConfig and override that method. In that method you can return the styles you want to display.

_bv_
4 Oct 2011, 2:48 AM
I've got it. Thank you, Sven.
Is it possible to make an "hover" pseudo-class or some acronym in the stylesheet then?