Sorting does seem to work out of the box. I ended up building my own
comparators.
Here's an example of what I did. I was going to write up a longer blog
entry on this -- just haven't had time.
Let's say I have a simple object like this for my RowValue:
public class Person {
private final String first;
private final String last;
public Person(String first, String last) { first = first; last = last; }
public String getFirst() { return first; }
public String getLast() { return last; }
}
So, I have to define my table model for Person =>
private final classs DataSourceTableModel extends MutableTableModel<Person>
{
private List<Person> list = new ArrayList<Person>();
public void setData(List<Person> list) { this.list = list; }
public void requestRows(final Request request,
TableModel.Callback<Person> callback) {
callback.onRowsReady(request, new Response<Person>() {
@Override
public Iterator<Person> getRowValues() {
int col =
request.getColumnSortList().getPrimaryColumn();
boolean ascending =
request.getColumnSortList().isPrimaryAscending();
/* col tells you which column the user clicked and
ascending indicates whether to sort up/down */
/* i wrote my own Sorter class that knows how to sort a
collection of my own RowValue T here */
/* return the iterator of your sorted collection */
}};
}
}
There's a bit more to it, but I found that PagingScrollTable does not sort
by itself -- never worked for me. I filed a bug on it. Thus, I do the
sorting myself, and it works well.
Hope that helps,
Davis
On Mon, Nov 2, 2009 at 11:35 PM, shloka <[email protected]> wrote:
>
> Hi All,
> I am trying to implement pagination and sorting using the Incubator's
> paging scroll table .Could do pagination but Sorting is not happening.
> Please pool in some ideas to solve this.Any guidence is highly
> appreciated.,,,,
> Thanks in Advance.
>
> >
>
--
Zeno Consulting, Inc.
home: http://www.zenoconsulting.biz
blog: http://zenoconsulting.wikidot.com
p: 248.894.4922
f: 313.884.2977
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---