Not able to use Celltable for a requirement where I need different widgets under one column.

84 views
Skip to first unread message

Saurabh Tripathi

unread,
Sep 2, 2012, 5:43:43 AM9/2/12
to google-we...@googlegroups.com
Hi all,

I am stuck here with a requirement which is mentioned as follow:

1)A table where one or more (for now just one) column need to have different widgets in editable cell.
               for example: Class is Plant having property: 'name' and access method: 'String getName()';
                                  Now if(name.equals("true") || name.equals("false"){
                                                         ---> Render CheckBox with respective checked value
                                         }else if(name.equals("~")) {
                                                       -----> Render ListBox with some predefined items
                                         }else {
                                                        ----->just render the String.
                                         }
2)The cell where we render just the String should be Editable (i.e on click textbox appear for edit), other than this other cells should be non-editable i.e cells for checkbox and listbox should be non editable,

You may find this requirement very unusual and I agree it is because here we dealing with raw xml/text kind of metadata.
Anyway I have given a lot of effort over this, but I am in a catch 22 situation if somehow I am able to attain 1 condition than I am have editable problem, if somehow I make that up, the valueupdater doesn't seem to work properly........................................

At last I am thinking that may be 'CellTable' API was never there for such kind of requirement. So FlexTable could be the answer.
Even if it is so there would be a lot of work for me then like -> implementing sorting(while click on header), pagination etc, it would be great if
some open source library is already there for it.                 

Thanks in advance    

David

unread,
Sep 4, 2012, 7:30:24 AM9/4/12
to google-we...@googlegroups.com

Sorting and pagination can merely be implemented as glorified Anchors whose job is to reload your table after performing an rpc request for different criterion.

Adam T

unread,
Sep 6, 2012, 11:37:35 AM9/6/12
to google-we...@googlegroups.com
Hi!

You should be able to use custom table rendering of a GWT 2.5 cell table to do what you want in your point (1) (extending AbstractCellTableBuilder and implement the buildStandardRowImpl method to put the relevant cell type into the column that alters based upon your condition in your point (2).  Then pass that renderer to the cell table, instead of the standard one, using its setTableBuilder method)

Information about this is a little sparse, but you could check out:

* GWTinAction edition 2 - a relevant example (different cells in the Tags column) can be found in code here. (it is still work in progress just now, so missing comments, but should be relatively self explanatory)

Hope that helps in some way!

//Adam
Reply all
Reply to author
Forward
0 new messages