|
Re: dojo.data - simple paging example: msg#00014web.dojo.devel
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? I'm not opposed to having both options, but I like the single-result set approach presented here. In writing these sorts of apps, especially with async queries, it seems like it would be advantageous to have a single result set that the app author deals with rather than having to manage multiple sets. For example, it's pretty common to load data in bigger chunks than you want to display -- that way "next page" can be instantaneous (although the next page after *that* may take a while -- we take what we can get). Presumably, it should be pretty easy to make a display- tabley-widget thing that could implement this automatically -- whenever it displays a page, it goes and fetches the data for the next page in the background. Or you might be able to teach your tabley-widget that some items may be in memory, while some aren't. So if you have half of the next page of things, it displays the half that it has, with a little "loading..." message for the ones it can't find yet. Then when those load, their loading messages replaced in the table with real data. This type of thing is great for UI, because the user can see that something is happening immediately, and results can come back in as they are ready. It seems like the single result set is almost a must for the "infinite scrollbar" case -- managing multiple result sets would be a real pain. There is another UI paradigm that this is also great for -- where you start with a small table (say 10 items), then the last item says "more...". They click the button and those items load underneath the set already present. I did a quick mockup of that [can you tell I'm procrastinating?], enclosed -- drop the files in the same folder as Brian's example to see it. Finally, one thing that I'd expect to see in the params available to the method forEach() calls is the index in the result set of the item being iterated on. Without this, I was dependent on the server setting the "identity" column. If it doesn't make sense to pass it as a parameter to the function, perhaps there can be a flag that indicates that an index should appear in the result set data? Fun stuff! cheers O
------------------------- Whenever I despair, I remember that the way of truth and love has always won. There may be tyrants and murderers, and for a time, they may seem invincible, but in the end, they always fail. Think of it: always. -- Mohandas K. Ghandi On Oct 1, 2006, at 6:49 PM, Brian Douglas Skinner wrote: For people intested in the dojo.data design... _______________________________________________ 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: | dojo.data - simple paging example: 00014, Brian Douglas Skinner |
|---|---|
| Next by Date: | Re: dojo.widget.validate: 00014, Bill Keese |
| Previous by Thread: | dojo.data - simple paging examplei: 00014, Brian Douglas Skinner |
| Next by Thread: | Re: dojo.data - simple paging example: 00014, Brian Douglas Skinner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |