Opened 12 years ago

Closed 12 years ago

#4257 closed task (fixed)

Tree: allow connection to relational data stores

Reported by: bill Owned by: bill
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

Currently Tree can't work with a typical relational data store that defines primary-foreign keys. Example:

{type: "country", name: "USA"},
{type: "state", name: "California", parent: "USA"}

Tree won't detect that California is a child of USA.

Since 99% of the world's data is relational, we need to have a generic way of supporting this common situation.

One possibility is for the store itself generates a sort of faux "child" attribute in each item. That's possible, but I think Tree should against data stores that don't do this too.

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 queries and accessing child items is an asynchronous operation) then I think it works.

Change History (4)

comment:1 Changed 12 years ago by bill

(In [10380]) Refactor tree to have overridable functions for datastore access, thus allowing access to relational or other-shaped data. This also removes the MVC architecture which seemed to be more trouble than it's worth (and required an extra 100 lines of code). Needs a testcase for a relational data store. Refs #4257.

comment:2 Changed 12 years ago by bill

(In [10398]) Fix case where setChildren() called with empty array. Refs #4257.

comment:3 Changed 12 years ago by bill

(In [10402]) Fix various bugs with updates to store. Fixes #4333, refs #4257.

comment:4 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

This is fixed. See demos/i18n.html for testcase.

Note: See TracTickets for help on using tickets.