Wednesday, July 17, 2013

DataGrid sorting and using setList in ListDataProvider

Hi,
 
I just lost 2 hours on getting sorting to work correctly in my DataGrid backed by a ListDataProvider.
 
I was calling setList( rows ) on the DataProvider to update the table and that works... but sorting was not working (I could not even see the sort indicator on the table header cells).
Then it struct me: The ColumnSortEvent$ListHandler class takes a List as argument instead of the ListDataProvider.
When you call setList() on the DataProvider a new wrapper is created and my ListHandler is looking at the wrong one.
 
Wouldn't it be better that the ListHandler would keep a reference to the ListDataProvider instead ? Then it can call getList() on it when a sort is needed.
 
It is now a bit asymetric: calling setList() updates the table rows, but the sorter does not know... I am sure many people fall in this trap!
 
David

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment