[dojo-contributors] dijit.Tree assumes datastore implements Identity API

Brian Douglas Skinner skinner at dojotoolkit.org
Tue Aug 21 17:12:27 EDT 2007


>> I think a datastore can probably always just make up a unique 
>> id for each item, even if there's no unique id embedded in the 
>> data itself.  For example, a .csv file won't necessarily have 
>> an id column in the file itself, but our dojox.data.CsvStore 
>> still provides a getIdentity() implementation by just returning 
>> the row number of the item in the file.
> 
> The issue is for data stores that involve a server.  Maybe there's 
> some server interface that doesn't provide ids?  I guess for google 
> you can use the URL as the ID and for Flickr there's probably an 
> id, but for an arbitrary server, if you do some query like
> 
> getData.php?attr1=foo
> 
> and then it returns a list of item without id's, you're stuck.  
> I'm not sure if that would ever happen in real life though?

I see.  Thanks for the explanation.

Even in that case, couldn't the datastore still assign unique id's to 
the items if it really wanted to?  The unique id could be a compound key 
with two parts, like "xyz-267", where "xyz" is a unique identifier for 
the query that was sent to the server, and "267" is the index of the 
item in the result set returned by the server?

:o) Brian





More information about the dojo-contributors mailing list