[dojo-contributors] mail demo!

Brian Douglas Skinner skinner at dojotoolkit.org
Mon Aug 20 19:22:21 EDT 2007


Sam wrote:
> > I know people are also going to ask: how do I make that store
> > server-backed, in such a way that I can page through the list 
> > and not download the data for my entire inbox at once to populate 
> > the store.  That seems to be dojo.data faq #1

Yup, it would be great to have a demo with a very simple datastore that 
shows how to do that.  We've got documentation that describes how to use 
a paging datastore, but it would also be useful to have a demo 
implementation that actually does incremental loading (rather than just 
paging through pre-loaded data, as our current datastores do). 
Documentation here:
http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/data-retrieval-dojo-data/pagination


Bill wrote:
> Yup, and we need a demo of that.  Any volunteers?  I think just a 
> PHP file that can handle queries and return JSON:
> 
> foo.php?type=message&folder=inbox
> 
> And then a dojo.data store to connect to it.
> 
> IIRC there's an SoC project to write a data store for MySQL but for the
> purposes of a mail demo I think something simpler is better.

To demo load-on-demand paging, wouldn't you want the URL for the PHP 
script to also include the paging info?  Something like this:

foo.php?type=message&folder=inbox&start=40&count=20


Michael wrote:
> Yes, the SoC project for the dojo data Overdrive store is nearing 
> completion. Unfortunately, it won't make the cut for the 0.9 release, 
> so we're aiming for 1.0. The Overdrive store depends on mysql on the 
> server, but it would be an interesting exercise to see if it would 
> run under any webservice that could interpret SQL queries and return 
> JSON results. I'll be reviewing the code over the next week and provide 
> some updates to everyone.

The Overdrive store is SQL-based, but I think at the moment it may 
actually load the entire database at once, rather than doing on-demand 
paging.  But I haven't actually looked at the Overdrive code, so I'm 
just guessing based on what I've read about it.

> So, I believe the only option for 0.9 is to do as Bill suggested 
> with a PHP URL for
>      foo.php?type=message&folder=inbox
> Other than Overdrive, there are no existing datastores that allow 
> lazy-loading of data. So this URL method, used with ItemFileReadStore, 
> would probably require a new datastore to be created with each different 
> set of Query String parameters, since the ItemFileReadStore will only 
> query the server once for all of the data that is requested.

Yes, ItemFileReadStore simply wasn't designed to do on-demand loading of 
data.  It was originally meant to be a simple store, and it loads an 
entire data file all at once.

Using ItemFileReadStore and creating a separate new datastore for each 
set of query string parameters seems like a bad idea, since it would be 
a hack work-around, and wouldn't really demonstrate the intended 
patterns for implementing or using a datastore.  It would be better to 
write a new demo datastore that could just load a page at a time.

> I'll provide more information about Overdrive when it is 
> available.

Cool.  Look forward to hearing about the new Overdrive store!

:o) Brian




More information about the dojo-contributors mailing list