wfaler wrote:
> 
> I have found a bunch of stuff around IDataProvider, DataView etc, but I
> haven't found any meaningful examples that helps a great deal..
> 

Some sample code below. There is a whole chapter on this topic in my e-book
(see my signature for location).

public class LazyLoad extends WebPage {

        public LazyLoad() {
                IColumn[] columns = new IColumn[] {
                                new PropertyColumn(new Model("col1"), 
"intValue"),
                                new PropertyColumn(new Model("col2"), "class") 
};
                ISortableDataProvider dataProvider = new SortableDataProvider() 
{

                        public int size() {
                                return 300000;
                        }

                        public IModel model(Object object) {
                                return new Model((Integer) object);
                        }

                        public Iterator iterator(int first, int count) {
                                return loadEntriesFromDatabase(first, 
count).iterator();
                        }

                        private List<Integer> loadEntriesFromDatabase(int 
first, int count) {
                                List<Integer> items = new ArrayList<Integer>();
                                for (int i = 0; i < count; i++) {
                                        items.add(new Integer(first + i));
                                }
                                return items;
                        }

                };
                DefaultDataTable t = new DefaultDataTable("t", columns, 
dataProvider, 3);
                add(t);
        }
}


-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Lazy-loading-pageable-listview-tf4587413.html#a13113194
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to