About DataTable and SortableDataProvider, I believe the designer's assumptions are that in typical use:
(1) the DataProvider will not cache any data, (2) each call to iterate() will do a select from the database, (3) each call to size() will do a select from the database, and (4) the number of elements in the database will not change between calls (or if the data does change, we don't care that the screen might show inconsistent results as the user pages back and forth). What if we want the pages to show a consistent view, even though the data might change as the user is paging through it? If the data volume is not too huge, I suppose one could page through a snapshot of the data. To me, that suggests putting all the data in the webpage and using JavaScript to page through it without resubmitting. However, Wicket-Extensions provides no widget with this sort of client-side functionality. Even if we had such a widget, its use would be impractical if the dataset were too huge for a single page download. What one can do with the current DataTable -- at least if the number of concurrent users is small and the size of the result set is reasonable -- is to have the SortableDataProvide retrieve all the data at once and cache it in session storage between pages. Since we don't know whether size() or iterate() will be called first, each will have to check whether the data has already been obtained, and if not then to obtain the data for both methods to use. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manuel Barzi Sent: Thursday, November 23, 2006 6:25 AM To: [email protected] Subject: [Wicket-user] SortableDataProvider, size() & iterator(int first,int count), Correct execution order? Hi, there, I have the following composition: WebPage >... ... DataView > CustomProvider extends SortableDataProvider ... PagingNavigator > DataView The ERROR? I found is this: When clicking on any of the navigation buttons (PagingNavigator), my CustomProvider implementation is managed by Wicket FW calling its implemented (abstract in SortableDataProvider) in the following order: 1 size() 2 iterator(int first, int count) That causes wrong results, because it calls first the size() to check the results obtained when I havent called the iterator(...) yet, and inside my implementation of iterator(int first, int count) I obviously do the call to the API that accesses to my persistent layer obtaining the results according to the specified (first, count) pair... So, what happens in practice... that when navigating the size() method retrieves the before obtained iterator.size(), and not the new one that will be obtained immediatly after it, when calling to iterator(...). So, if the order was this: 1 iterator(...) 2 size() The problem would be solved... Please, would you mind explaining my how to resolve this issue? Thank you! M ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE V _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
