CellTable updating individual/non-consecutive rows

45 views
Skip to first unread message

Rike255

unread,
Jul 5, 2011, 4:45:57 PM7/5/11
to Google Web Toolkit
I can't figure out a good way to update a single row of data after
using setRowData() to populate a CellTable.

Specifically, I have an ArrayList of objects that represent rows that
need to be updated, but they are not consecutive. Is there a way to
update one (or multiple non-consecutive) rows in a celltable without
refreshing the whole thing (or from an index to the end)?

Thanks!

Adolfo Panizo Touzon

unread,
Jul 6, 2011, 7:27:08 AM7/6/11
to google-we...@googlegroups.com
If I understand you, when you create the CellTable you can add a setFieldUpdater. With this way you have control to update the rows like you want (you have a "int index").


--
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.




--
El precio es lo que pagas. El valor es lo que recibes.
Warren Buffet

Thomas Broyer

unread,
Jul 6, 2011, 7:48:33 AM7/6/11
to google-we...@googlegroups.com
You'll call setRowData(int,List) for each set of consecutive rows to update:
table.setRowData(2, Collections.singletonList(thirdRow));
table.setRowData(10, Arrays.asList(eleventhRow, twelfthRow));

Rike255

unread,
Jul 6, 2011, 11:19:17 AM7/6/11
to Google Web Toolkit
Thanks guys both answers look like they'll help, I'll read into both.

On Jul 6, 5:27 am, Adolfo Panizo Touzon <adolfo.pan...@gmail.com>
wrote:
> If I understand you, when you create the CellTable you can add a
> setFieldUpdater. With this way you have control to update the rows like you
> want (you have a "int index").
>
> http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/g...
>
> See you.
>
> 2011/7/5 Rike255 <rgro...@gmail.com>

Jeff Larsen

unread,
Jul 6, 2011, 12:14:41 PM7/6/11
to google-we...@googlegroups.com
Also, rendering the whole table is generally really fast. I would test it out to see if it is worth the effort to selectively update rows. 

Thomas Broyer

unread,
Jul 6, 2011, 1:18:22 PM7/6/11
to google-we...@googlegroups.com
Well, actually, I'm not even sure Cell widgets currently re-renders only selected rows. It might very well render the whole thing whatever you do, selective rendering coming in a future release as a performance enhancement.

Jeff Larsen

unread,
Jul 6, 2011, 3:29:06 PM7/6/11
to google-we...@googlegroups.com
There are hooks in HasDataPresenter for rendering a specific subset of rows,but I haven't actually tested it. 
Reply all
Reply to author
Forward
0 new messages