pjekel/cbtree

Add support for dojo/store, as replacement for dojo/data?

Closed this issue · 4 comments

Hi,

Great work on cbtree! I was planning to write my own before I stumbled on yours.

Any plans for supporting the new dojo/store API, as a replacement for dojo/data?

I'd really like to use something like this as the store:
require(['cbtree/Tree','cbtree/models/ForestStoreModel', 'dojo/store/Observable','dojo/store/JsonRest'],
function(cbtree, cbmodel, Observable, JsonRest) {
var store = new Observable(new JsonStore({target: '/path/to/store'}));
var model = new cbmodel({store: store})
...
});

Or is this functionality hidden somewhere I haven't found yet?

There will be basic dojo/store support in cbtree for dojo 1.9. I emphasize basic as IMHO the current dojo/store is nothing more than a glorified array. If you want to do anything more than a simple set of objects you have to write your own store. In addition, there is no support for multi parented objects and as a result you are not even able to create a simple family tree, that is, assuming every child actually has a mother AND a father :-)

Because of all the limitations the current store is imposing on its users, or should I say lack of features, I'm working on a full implementation of the W3C Index Database API: http://www.w3.org/TR/IndexedDB/ which eventually will be released as a separate project. However, it's going to take a little time before it is ready for release.

Hi,

Well, I do notice built-in support for a "before" attribute for ordering items within a store. And it seems relatively trivial to add a getChildren()/getParent() functionality to a store, if we can decide upon an API.

Dgrid's Tree column module expects a getChildren() method to be implemented on a store.

I'm thinking of implementing my own version of ForestStoreModel to wrap a dojo/store and use the same conventions as Dgrid's tree.

Would you consider a pull request, if I do so?

And would you have any preferred name for such a model?

Cheers,
John

I have add support for the dojo/store and observable in the dojo-1.9 branch. Give it a try.

Sweet! Thanks... I'll check it out.