create dinamically celltable

19 views
Skip to first unread message

alf

unread,
Nov 22, 2010, 10:13:41 AM11/22/10
to Google Web Toolkit
How can I create a content of table without previosly has a class with
models.

I can cretate a header of column but when I set a list like
Arrays.aslist{"",""} only fill a first column a repite the same in
other column. I would like send a matrix colum & row to fill table
correctly.

many thanks

John LaBanca

unread,
Nov 22, 2010, 12:56:40 PM11/22/10
to google-we...@googlegroups.com
You can't specify a matrix to fill a CellTable.  You have to declare an object that represents each row, then add columns to pull the values out of the row.

The closest thing to a matrix is to declare the CellTable as type List<String> (CellTable<List<String>>).  Then add columns that read the associated index, so column 0 reads list.get(0), column 1 reads list.get(1), etc...  Then you can pass a List<List<String>> to setRowData().

Thanks,
John LaBanca
jlab...@google.com



--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


alf

unread,
Nov 22, 2010, 1:42:34 PM11/22/10
to Google Web Toolkit
I understand idea but for me is very complex I am a newie on java. May
be you know a link o sample where I can learn a "HowTo"

thanks
alberto

On Nov 22, 6:56 pm, John LaBanca <jlaba...@google.com> wrote:
> You can't specify a matrix to fill a CellTable.  You have to declare an
> object that represents each row, then add columns to pull the values out of
> the row.
>
> The closest thing to a matrix is to declare the CellTable as type
> List<String> (CellTable<List<String>>).  Then add columns that read the
> associated index, so column 0 reads list.get(0), column 1 reads list.get(1),
> etc...  Then you can pass a List<List<String>> to setRowData().
>
> Thanks,
> John LaBanca
> jlaba...@google.com
>
>
>
>
>
>
>
> On Mon, Nov 22, 2010 at 10:13 AM, alf <alberto....@gmail.com> wrote:
> > How can I create a content of table without previosly has a class with
> > models.
>
> > I can cretate a header of column but when I set a list  like
> > Arrays.aslist{"",""} only fill a first column a repite the same in
> > other column. I would like send a matrix   colum & row  to fill table
> > correctly.
>
> > many 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 google-we...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .

John LaBanca

unread,
Nov 22, 2010, 4:34:02 PM11/22/10
to google-we...@googlegroups.com
The dev guide has a fairly simple example of CellTable:

There is also one in the checked in javadoc, which is slightly more complicated:

I don't know of an example that uses a List of Lists, but its probably better to represent your row values as specific type instead of just using a List of Strings.

Thanks,
John LaBanca
jlab...@google.com


To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages