Clearing view(s) via AsyncListViewAdapter

6 views
Skip to first unread message

Jaroslav Záruba

unread,
Jun 13, 2010, 8:06:14 PM6/13/10
to Google Web Toolkit
Hello

I assume the proper way to manipulate data in views without a round-trip to server* would be to call:
AsyncListViewAdapter<T>.updateViewData(int start, int length, List<T> values);
But that does nothing when I try to clear the data:
AsyncListViewAdapter<T>.updateViewData(0, 0, new ArrayList<T>());

Looking at AbstractListViewAdapter<T>.updateViewData it seems to me that the line #186 makes it impossible to assign empty data to any view. Is that correct behavior?
Or am I missing something please?

*) Like after you have created or deleted a record/item/entity on the server and want to reflect such change in your view without reloading the data from server.

Regards
  J. Záruba

Jaroslav Záruba

unread,
Jun 13, 2010, 9:01:46 PM6/13/10
to Google Web Toolkit
As I'm thinking of this more, the view also must respect given
pageSize nd dataSize. Therefore to have view/table 0 rows high when
the view is set to pageSize=15 and thinks dataSize=1156 would be kinda
'uncertain'. The table would have to display empty row, or rows, and
they would have identical (~'empty') key, which would be quite mess.
Clearing a view makes probably sense only in conjunction with setting
dataSize=0. (Hopefully it works, too late to test that now though.)

Seems like I should reconsider that original approach. My apologies
for this monologue! :P

On Jun 14, 2:06 am, Jaroslav Záruba <jaroslav.zar...@gmail.com> wrote:
> Hello
>
> I assume the proper way to manipulate data in views without a round-trip to
> server* would be to call:
> AsyncListViewAdapter<T>.updateViewData(int start, int length, List<T>
> values);
> But that does nothing when I try to *clear* the data:
> AsyncListViewAdapter<T>.updateViewData(0, 0, new ArrayList<T>());
>
> Looking at AbstractListViewAdapter<T>.updateViewData<http://code.google.com/p/google-web-toolkit/source/browse/branches/2....>it
Reply all
Reply to author
Forward
0 new messages