Friday, April 29, 2011

How to update CellTable's Header Cell based on action in data table

Hey everyone! I have a question that I cannot seem to find the right
answer to. I'm using a 2 cell tables, one for a fixed header with one
row that scrolls with the other which holds my main data rows.
Basically, I want to implement a tri-state checkbox in one of the
column headers. I was successfully able to create a new
TriStateCheckboxCell that extends AbstractCell and it is wrapped by a
Header<Enum>. Using this class I render either an unchecked input
(checkbox) when no rows in the main table are selected, a checked
input when all the rows in the main table are selected, or an img that
represents an intermediate state of a checkbox when only some of the
rows in the main table are selected. Using a ValueUpdater I can
select all or none of the rows in the main table when the Header's
TriStateCheckboxCell is clicked. All of this works fine. My problem
comes when the user selects a row in the main table and I want to set
the Header's checkbox to the intermediate state. This calls for me to
update or re-render the contents of the Header Cell when the selection
model has been changed. So in my SelectionModel's
SelectionChangeEvent onSelectionChange method I need to update the
cell. This would involve calling it's onBrowserEvent or setValue
method, both of which take the parent Element as a parameter. Only,
Cell does not contain a reference to or extend the Element class. The
problem is that in order to re-render the Cell, I need it's parent
Element. Obtaining this Element is not straightforward to me. I was
able to get it by manually traversing the DOM via the
CellTable.getElement and going down, however this is not ideal. Is
there other methodology that I am not aware of? Am I thinking about
this the wrong way? Thanks!

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment