[dojo-contributors] tree/dojo.data problems (nee: Re: [Dojo-interest] [ANN] Dojo 0.9 Final)

Jared Jurkiewicz jared.jurkiewicz at gmail.com
Tue Aug 21 08:59:24 EDT 2007


Bill,
   Agreed on the idea of adding user definable functions to tree to
let you over-ride how the tree interprets items from a specific store.
 That seems a pretty straightforward approach (since each store's
items will generally have different attributes that mean different
things.).  Woul you still keep the simple baseline implementation of
providing a child attribute that could be a list of the items children
as the default?

BTW, store.getValues() isn't asynchronous, its sync.   Though I guess
you chould wrap around it and make it appear, to the Tree, that its
async.  getValues() just returns an array of an item's attribute
values (0 to many, depending on the actual item).  Over which you can
iterate an isItem() test, then isItemLoaded(), to determine if lazy
loading must occur because the items data has not fully been populated
yet (or not, if all data is already available for that item).

Sincerely,
-- Jared Jurkiewicz

On 8/21/07, Bill Keese <bill at dojotoolkit.org> wrote:
> Jared Jurkiewicz wrote:
> > Ah, you want bidirectional references, effectively.  Well, the meaning
> > of an attribute doesn't have to mean 'children' on ItemFileReadStore.
> > You could always put a reference from a child node back to the parent
> > with a specific attr name, like 'parent'.
>
> Right, except that it's more complicated than that because for example
> an employee might belong to both a group (like engineering) and a site
> (like Austin), so he/she has more than just a single parent pointer.
>
> Anyway, I've thought about this some more.  First of all, since 99% of
> the world's data is relational, we need to have a generic way of
> supporting this common situation.
>
> However, I think thre Tree can handle this better than adding features
> to the store.  If we provide (user-definable) methods to the tree:
>
> isFolder(item)
> getChildren(item)
> getParentIdentity(item)
>
> then we can make tree work with any store:
>
> <div dojoType=dijit.Tree store=geographyStore>
>         <script type='dojo/method' event='getChildren' args="item">
>                 return this.store.fetch(...)
>         </script>
> </div>
>
> Clearly it's more complicated than that because of the async issues, but
> if I can hide the differences between a store.fetch() and a
> store.getValues() (both are asynchronous and return an array) then I
> think it works.
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>



More information about the dojo-contributors mailing list