DataGrid being a "cell widget", it will be "re-rendered" regularly, losing
all modifications you manually did to the DOM tree.
You can "persist" your changes using setRowStyles for classnames applied to
a TableRowElement, or custom column with overridden getCellStyleNames
<http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/cellview/client/Column.html#getCellStyleNames-com.google.gwt.cell.client.Cell.Context-T->
for
classnames applied to a TableCellElement, or a custom CellTableBuilder for
more complex custom rendering; or you can use a RedrawEvent.Handler to
reapply your changes every time the grid is re-rendered.
On Tuesday, May 30, 2017 at 3:50:01 PM UTC+2, Santanu Banerjee wrote:
>
> I am trying to apply background colour to some rows dynamically based on
> some program logic, but I can see that the colour is disspearing on any
> further row selection.
> I used two approaches to change the colour.
> 1) baseGrid.getRowElement(i).getCells().getItem(0).addClassName(<css
> style>);
>
Use a setRowStyles(), with a RowStyles implementation that returns <css
style>
> 2)TableCellElement cell =
> grid.getRowElement(i).getCells().getItem(colIndex);
> cell.getStyle().setProperty("background", "#DDDDDD");
>
> Could you please suggest any alternative ways I can do it. so that the
> background colour of the rows do not change on any further row selection?
>
> Thanks,
> Santanu
>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.