Tuesday, February 1, 2011

Re: Selecting and disabling elements in CellTable

On Tue, Feb 1, 2011 at 3:38 PM, Greg Dougherty <dougherty.gregory@mayo.edu> wrote:
Jeff:

Column 1 : Column 2 ; Column 3
Column 1 :Column 3
Column 1 : Column 2 ; Column 3

I thought you said column, Geg, not an individual row's cells and naturally I took that then to mean all check boxes within a column. Is that what you said or do I have a pencil sticking out of my head :)?

In any case it's now obvious what your intention is so here's one way to do this but it is by no means the only way:

Iterate row by row through your cell table and for each row iterate through each of its cells. If a cell contains a checkbox that needs to be disabled then get the cell's inner html which will be a checkbox. Once you have the checkbox just set it's enabled property to false or better yet hide the checkbox by setting its display attribute to none.

There are numerous GWT methods that can assist you in iterating over the DOM and in particular a table. For instance, I use TableElement often, especially TableElement.as which assert that the given Element is compatible with a TableElement and automatically typecast it. Once I have a valid TableElement reference I can then get a reference to its rows by calling its getRows method - just remember to compensate for any table header rows you may have. Once you have a NodeList<TableRowElement> use its TableRowElements to obtain the cells by calling it getCells method. Once you have the cells you can then iterate over each one and do with them as you like.

Jeff

Jeff
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment