Re: [newb] sorting, paging table

2007-08-23 Thread Igor Vaynberg
On 8/23/07, somethingRandom [EMAIL PROTECTED] wrote:


 I am trying out wicket, coming from the action-based world, so please bear
 with me.

 I made a simple report (we have a backend using spring and hibernate in
 place). It was very easy to take the ArrayList that hibernate returns to
 me
 and display that in a DataView using the ListDataProvider.

 So I look into trying to add some sorting and paging and decide that the
 AjaxFallbackDefaultDataTable looks like the ticket. But now it looks like
 I
 also need to write 3 or 4 new classesl,


which are what?

and write sort methods for each
 property of my pojos. It's not really this difficult, is it?

 What's the easiest way to take an arraylist of objects and display them in
 a
 sortable, pageable table?


class mydataprovider extends sortabledataprovider {
abstract List getList(String sortcol, boolean asc) { // implement this
yourself and return the properly sorted list }
imodel model(object o) { // implement yourself }

int size() { return getList(getSort().getProperty(),
getSort().isAsc()).size(); }
iterator iterator(int first, int count){ return
getList(getSort().getProperty(), getSort().isAsc()).sublist(first,
first+count); }
}

just one small class looks like to me

-igor




}


Thanks
 --
 View this message in context:
 http://www.nabble.com/-newb--sorting%2C-paging-table-tf4319230.html#a12299554
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: [newb] sorting, paging table

2007-08-23 Thread somethingRandom



igor.vaynberg wrote:
 
 On 8/23/07, somethingRandom [EMAIL PROTECTED] wrote:
 What's the easiest way to take an arraylist of objects and display them
 in
 a
 sortable, pageable table?
 
 
 class mydataprovider extends sortabledataprovider {
 abstract List getList(String sortcol, boolean asc) { // implement this
 yourself and return the properly sorted list }
 imodel model(object o) { // implement yourself }
 
 int size() { return getList(getSort().getProperty(),
 getSort().isAsc()).size(); }
 iterator iterator(int first, int count){ return
 getList(getSort().getProperty(), getSort().isAsc()).sublist(first,
 first+count); }
 }
 
 just one small class looks like to me
 
 -igor
 

That is much more concise than any examples I've seen before.

Thank you very much. 
-- 
View this message in context: 
http://www.nabble.com/-newb--sorting%2C-paging-table-tf4319230.html#a12304212
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]