Ticket #5876 (closed enhancement: wontfix)
QueryReadStore: support _reference
| Reported by: | bill | Owned by: | wolfram |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | DojoX Data | Version: | 1.0 |
| Severity: | normal | Keywords: | |
| Cc: | jaredj, josh@… |
Description (last modified by bill) (diff)
See http://www.dojotoolkit.org/comment/reply/5559/12172#comment-12172. In order to use QueryReadStore for dijit.Tree, or any kind of application where one item points to another item, need to support that functionality inside of QueryReadStore.
Presumably the initial GET request for an item returns something like
{ name:'Asia', type:'continent',
children:[{_reference:'China'},
{_reference:'India'},
{_reference:'Russia'},
{_reference:'Mongolia'}] }
and then store.isItem( {_reference:'China'} ) returns true, and store.isItemLoaded({_reference:'China'}) returns false, but then store.loadItem({_reference:'China'}) will convert that into an actual item.
Of course it's pretty inefficient to make a separate GET call for each of the children of Asia. Might be better to get them all at once... It's also inefficient to have to list stubs for each child item to begin with. It would be better to just have a stub for the whole children array, like:
{ name:'Asia', type:'continent',
children:[ _stub ] }
Unfortunately that's also got issues, given the dojo.data API, since store.getValues(item, "children") is synchronous, and it's bad to make a synchronous call do a GET request.