Row header’s don’t get caught in the setCellStyleGenerator(…) method. Am I doing something wrong? I am just using setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
and I definitely see the row headers in the UI. I basically want to skin row headers a different color so I am trying to catch a row header in setCellStyleGenerator(…) and customize it via css.
Basically in the method it first goes to the row, then “skips” over the rowheader and then goes to my first column that I added.
The cell style generator will be called once with a propertyId of null, which means that the stylename that you return will be added to the
entire row instead of a specific cell. Using this “trick” you can set a stylename for the entire row and using that you can style the headers. See the
Table Row Headers sample in Sampler for example code.
Hi Jonatan, I also used first-child psuedo css selector to get at the rowheader. it would be easier if rowheader had its on css selector honestly. I can open a ticket.
“The cell style generator will be called once with a propertyId of null, which means that the stylename that you return will be added to the entire row instead of a specific cell. Using this “trick” you can set a stylename for the entire row and using that you can style the headers. See the Table Row Headers sample in Sampler for example code.”
I want to set a css class to three of the header columns with a CellStyleGenerator.
But getStyle only starts with itemId = 0, which seams to select only the first row and not the headers…
[quote=Anky S.]
Isthis still accurate for Vaadin 7.1.13?
“The cell style generator will be called once with a propertyId of null, which means that the stylename that you return will be added to the entire row instead of a specific cell. Using this “trick” you can set a stylename for the entire row and using that you can style the headers. See the Table Row Headers sample in Sampler for example code.”
I want to set a css class to three of the header columns with a CellStyleGenerator.
But getStyle only starts with itemId = 0, which seams to select only the first row and not the headers…
[/quote]The comment uses the word “headers” for row headers, not column headers. Interpreted this way, it is still accurate.
Unfortunately, as far as I can recall, cell style generators are not used for column headers. Thus, you may need to select the column header cells with CSS to style them individually. The upcoming Grid component (planned for Vaadin 7.4) should be much more flexible when available.
Well, I’m using “the upcoming Grid component” in Vaadin 7.7 and still cannot style the column header cells that show the column name (which are part, syntactically, of an HTML table header).