Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#13781 closed enhancement (fixed)

Tree: support dojo.store

Reported by: bill Owned by: bill
Priority: high Milestone: 1.8
Component: Dijit Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

Create a new model (dijit/tree/ObjectStoreModel?) to connect dijit.Tree to a dojo.store (rather than the old dojo.data API).

In 2.0 the Tree will only connect to dojo.store, and the interface between Tree and model can be simplified, but for now making a new model could be a practical stopgap.

It will lean on the "mythical" getChildren() method documented in the dojo.store API... mythical in the sense that no stores implement that method, but rather apps must add it themselves. Presumably given the design of dojo.store, Observable, etc., it will make sense for getChildren() to be implemented as a query against the store, which means that the store will be relational, where items are stored flatly, and children point to their parents.

Attachments (1)

ObjectStoreModel.js (7.0 KB) - added by bill 6 years ago.
work in progress

Download all attachments as: .zip

Change History (12)

comment:1 Changed 6 years ago by bill

Note: for newItem(), consider not checking if an item with the same id already exists, and instead execute synchronously, and return the return value from store.put(). See #11806.

Changed 6 years ago by bill

work in progress

comment:3 Changed 6 years ago by bill

In [26986]:

Initial draft of dijit.tree.ObjectStoreModel, a connector from a dijit.Tree to a dojo.store (a store implementing the new API). Refs #13781 !strict.

comment:4 Changed 6 years ago by bill

In [27010]:

With the new dojo.store API, we have no way of knowing when data store items are actually deleted. The most we can do is to keep track of when the Tree no longer displays an item, in which case it's as good as deleted. (But be sure not to confuse DnD with an item deletion.)

Refs #13781 !strict.

comment:5 Changed 6 years ago by bill

In [27016]:

Make sure that DnD moves are reported as a delete followed by an insert, so that the same TreeNode will be reused rather than a new TreeNode being created. Refs #13781 !strict.

comment:6 Changed 6 years ago by bill

In [27021]:

Simplify code by depending on dojo.store.Observable()'s behavior of updating the query result array (returned from the original query) as the result changes (due to data store modifications).
Refs #13781 !strict.

comment:7 Changed 6 years ago by bill

  • Resolution set to fixed
  • Status changed from new to closed

In [27028]:

Automated test for Tree against ObjectStoreModel. Tree_ObjectStoreModel.html supercedes Tree_ForestStoreModel.html (nee Tree.html), which will be deleted for 2.0.

The other Tree tests will eventually be converted from ForestStoreModel to ObjectStoreModel.

Fixes #13781 !strict.

comment:8 Changed 6 years ago by bill

In [27390]:

test_Tree_store.html has been replaced by the automated Tree_ObjectStoreModel.html test. Refs #13781.

comment:9 Changed 5 years ago by bill

In [29567]:

Tests for persistence, refs #13781.

comment:10 Changed 5 years ago by bill

In [30609]:

move ObjectStoreModel test data to a separate file, but loadable directly as an AMD module, refs #13781

comment:11 Changed 4 years ago by bill

In [31100]:

avoid spurious timeouts in test, refs #13781

Note: See TracTickets for help on using tickets.