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

Bill Keese bill at dojotoolkit.org
Tue Aug 21 02:20:11 EDT 2007


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.



More information about the dojo-contributors mailing list