|
dojo.data - simple paging example: msg#00013web.dojo.devel
For people intested in the dojo.data design... We've been talking about how we want scrolling and paging to work for large result sets. If there's a large result set, the UI might allow the user to go from page to page through the results. Or the UI might have a large scroll-view, and incrementally load data as the user scrolls. We've been talking about what the datastore API should look like for that use case. One option is for the GUI code make separate calls to store.find() each time the user pages forward, with each call getting a new result object, one result object per page of data. Another option is for the the GUI code make one initial call to store.find() to get a single result object, and then make separate calls to result.forEach(), each time asking to loop over just a portion of the virtual result set. The question is, should we encourage just that first option, or just the second, or allow for both? As a quick exercise to make all of this more concrete, this weekend I wrote some test code that uses the second option (one result object and multiple calls to result.forEach()). The test code uses the Yahoo web services APIs to run a Yahoo query, and then you can page through the results. I'm including the code as an attachment here, if you want to play around with it. To use it, first create a new "yahoo" folder in your dojo tests/data directory: trunk/tests/data/yahoo Unzip the attachment, drop the contents into the yahoo folder, and open the "paging_example.html" file. If you're looking at the code, the place to start is paging_example.js. There's a method runSearch(), which has the call to store.find(), and there's a method displayPage(), which has the call to result.forEach(). Let me know if you run into problems, and I can try sending the files in some other format. :o) Skinner
dojo-contributors mailing list dojo-contributors@xxxxxxxxxxxxxxx http://dojotoolkit.org/mailman/listinfo/dojo-contributors |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [Dojo-escalate] bug in dojo.lang declare: 00013, Eugene Lazutkin |
|---|---|
| Next by Date: | Re: dojo.data - simple paging example: 00013, Owen Williams |
| Previous by Thread: | test readyi: 00013, Jesse Kuhnert |
| Next by Thread: | Re: dojo.data - simple paging example: 00013, Owen Williams |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |