|
I was looking at the Library example and I noticed it uses a
PageableListView added to a PagingNavigator to display the List of books. In this case all the books are being populated from a single List. How do you handle the cases where you need pagation, but each request for a new page should go out o the server and get the new list. I don't like the idea of having to store potentially thousands and thousands of rows of data into a List just to create a sortable list. (I understand one initial query is needed just to get the overall size of the result set to create the page numbers, but that's a big difference in overhead vs having to populate all the potential objects from that query). To handle this in Wicket, would someone need to write a new component to satisfy this business need or can it be done using some standard iterating tag (similar to JSTL's forEach) and straight HTML? I'm new to using Wicket and still new to JSF as well, but I find the whole component type of architecture a mixed blessing. For simple stuff it's nice to have some out-of-the-box display features coded for you, but when you end up having to customize, I often find a pain. I know HTML and JSTL so coding my front end with simple JSTL and HTML is easy. It's a shame that it seems like these component based frameworks require you to work within the components to achieve what you want. For example, in JSF I was wanting to display a bunch of stuff in divs as I iterated over a collection. With standard JSTL and HMTL this is a piece of cake, but in JSF I couldn't even find a component to let me do this. Everyone said use the DataTable, but it didn't provide the functionality I needed. Thanks for any feedback. -- Rick ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! <a href="http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642">http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Wicket-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/wicket-user |
|
Administrator
|
Rick,
The components provided by the core wicket project are pretty basic in what they can accomplish out of the box. For your particular problem there are several options. One of them, which is very elegant if I may say so, are the repeaters in the Wicket extensions project. You can see them in action in the repeaters example. They use an IDataProvider that has two methods: one for getting the count, and one for getting a paginated iterator retrieving the results for the actual page rendered. The extensions project provides the DataView, which is an extension on the ListView that knows how to deal with the IDataProvider directly. There are more powerful options, such as sorting and other neat things. In our own application we only use DataViews now. The other option is to bake a solution yourself or try the wicket-contrib-data and wicket-contrib-data-hibernate3 jar files. However I think they have been superseeded with the repeater package in wicket-extensions. Martijn On 1/23/06, Rick Reumann <[hidden email]> wrote: > I was looking at the Library example and I noticed it uses a > PageableListView added to a PagingNavigator to display the List of > books. In this case all the books are being populated from a single > List. > > How do you handle the cases where you need pagation, but each request > for a new page should go out o the server and get the new list. I > don't like the idea of having to store potentially thousands and > thousands of rows of data into a List just to create a sortable list. > (I understand one initial query is needed just to get the overall size > of the result set to create the page numbers, but that's a big > difference in overhead vs having to populate all the potential objects > from that query). To handle this in Wicket, would someone need to > write a new component to satisfy this business need or can it be done > using some standard iterating tag (similar to JSTL's forEach) and > straight HTML? > > I'm new to using Wicket and still new to JSF as well, but I find the > whole component type of architecture a mixed blessing. For simple > stuff it's nice to have some out-of-the-box display features coded for > you, but when you end up having to customize, I often find a pain. I > know HTML and JSTL so coding my front end with simple JSTL and HTML is > easy. It's a shame that it seems like these component based frameworks > require you to work within the components to achieve what you want. > > For example, in JSF I was wanting to display a bunch of stuff in divs > as I iterated over a collection. With standard JSTL and HMTL this is a > piece of cake, but in JSF I couldn't even find a component to let me > do this. Everyone said use the DataTable, but it didn't provide the > functionality I needed. > > Thanks for any feedback. > > > -- > Rick > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > <a href="http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642">http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642 > _______________________________________________ > Wicket-user mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/wicket-user > -- Living a wicket life... Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1 is out: http://wicket.sourceforge.net/wicket-1.1 ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! <a href="http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642">http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Wicket-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/wicket-user |
|
In reply to this post by Rick R
In wicket extentions (the 1.2 stream) we have special Listviews/Repeaters for that in conjection with
models that supports just query things what is needed. See the wicket.extensions.markup.html.repeater.* package for Components/Models. In the wicket-examples/repeater we have examples for that. for example: public class ContactDataProvider implements IDataProvider { protected ContactsDatabase getContactsDB() { return DatabaseLocator.getDatabase(); } /** * retrieves contacts from database starting with index <code>first</code> * and ending with <code>first+count</code> * * @see wicket.extensions.markup.html.repeater.data.IDataProvider#iterator(int, * int) */ public Iterator iterator(int first, int count) { return getContactsDB().find(first, count, "firstName", true).iterator(); <<<<<<<<<<<<<<<<<<<<< } /** * returns total number of contacts in the database * * @see wicket.extensions.markup.html.repeater.data.IDataProvider#size() */ public int size() { return getContactsDB().getCount(); } /** * wraps retrieved contact pojo with a wicket model * * @see wicket.extensions.markup.html.repeater.data.IDataProvider#model(java.lang.Object ) */ public IModel model(Object object) { return new DetachableContactModel((Contact)object); } } On 1/23/06,
Rick Reumann <[hidden email]> wrote: I was looking at the Library example and I noticed it uses a |
| Powered by Nabble | Edit this page |
