If you are supporting paging, then a local sort will only sort the current page, whereas a database sort would sort the data return the results for the current page. For example, if you are on the first page and do a reverse sort, do you want to see all the names that start with z (database sort), or do you want to see all of the names that start with a in reverse order (local sort of the current page).
That being said, you can cache the values locally in a list and use ListSortHandler. Alternatively, you can add a ColumnSortEvent.Handler to CellTable and copy and sort the return of CellTable#getVisibleItems(). The code would be something like the following: cellTable.addColumnSortHandler(new ColumnSortEvent.Handler() { public void onColumnSort(ColumnSortEvent event) { List<T> newData = new ArrayList(cellTable.getVisibleItems()); // Copy the data if (event.isSortAscending) { Collections.sort(newData, myAscComparator); // Sort ascending. } else { Collections.sort(newData, myDescComparator); // Sort descending. } cellTable.setRowData(cellTable.getVisibleRange(), newData); } }); Thanks, John LaBanca jlaba...@google.com On Mon, Feb 14, 2011 at 12:53 AM, Josh K <kendrick.j...@gmail.com> wrote: > I've been developing an application in GWT that has data I've been > displaying in a CellTable. I've set it up with a few TextColumns and a > few EditTextColumns. I've got it set up to where if someone changes > the data in an EditText cell, it sends an asynchronous request to the > database and updates that row in the DB table. In short, I've got all > this working using AsyncCallbacks and an AsyncDataProvider. > > Since 2.2 came out, I want to implement column sorting, kind of like > is seen in this example: > http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTable > , but with an AsyncDataProvider. I want to sort the columns locally > because I think it'd be faster than making an Async DB call again each > time someone clicks to sort (which is the impression of what was > supposed to happen if I used an AsyncHandler. > > So I THINK what I'm looking for is some way to use a ListHandler with > an AsyncDataProvider? > > Can anyone shed some light on this? Maybe done it before or know the > direction I'm supposed to? If it's even do-able? > > -- > 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-web-toolkit@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- 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-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.