Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4544 closed defect (fixed)

Tree: DML doesn't work with query parameter

Reported by: guest Owned by: bill
Priority: high Milestone: 1.1
Component: Dijit Version: 0.9
Keywords: Tree Query ItemFileWriteStore Cc:
Blocked By: Blocking:

Description

Description:

-Given are two trees using one instance of a ItemFileWriteDatastore?.

-The first tree shows the records of the datastore unfiltered.

-The second tree is instanciated with a "query"-Attribute and shows just one of the first-level-nodes of the datastore.
-When you add a new first-level-node in the unfiltered tree, the new node is also shown in the second, "queried"-Tree.

Correct behaviour:

The Tree, that is filtered with the 'query'-attribute, should not show the new node, that was added in the unfiltered Tree.

Reproduction:

-Add the following lines in the test for the tree-notification of the dojotoolkit just below the first tree-Declaration in the file:

<strong>Queried Tree with identical ItemFileWriteStore</strong>
<div dojoType="dijit.Tree" id="myTree2" store="treeTestStore" query="{id: 'node1'}" labelAttr="name" somePropertyAttr="someProperty"></div>

-Select the Node with the Label 'node2' in the unfiltered Tree
-Create a new node by clicking the button for creating new nodes.

Change History (5)

comment:1 Changed 12 years ago by bill

Milestone: 1.1
Summary: Adding new nodes on trees using the identical datastore, butTree: DML doesn't work with query parameter

Right, it's a known limitation that the query parameter doesn't work in conjunction with DML. Not easy to fix given that in theory the query parameter can be anything (ie, it's a black box), so that Tree has no way of detecting whether a newly added top level item matches the query parameter, short of rerunning the query. Hmm, I guess that's what has to be done.

comment:2 Changed 12 years ago by bill

Milestone: 1.12.0

comment:3 Changed 12 years ago by bill

Milestone: 2.01.1
Owner: set to bill

I've done a bunch of work on Tree and will check in something for this. May make the default behavior to rerun the top level query every time a new node is added to the tree, or may require the user to do it manually, but will provide something.

comment:4 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

(In [12309]) - Fix DnD for Tree, specifically when dragging elements within the Tree

  • Refactor Tree to take a single item as the root node, rather than a set of items specified by a query. The root node of the tree can be hidden via the showRoot parameter. Query and label parameters deprecated; will be removed in v2.
  • implemented ForestStoreDecorator? which wraps a given store, mapping all items matching a given query as children of a synthesized root item. Use this to connect Tree to stores that don't have a single root item.

Reason for changes: The old tree design worked for simple cases but broke down for DnD. Refactoring let's users define handlers for when a node is added/removed from the top of the tree (ie, when it changes between a top level item and a child of another item, or vice-versa), and for efficiently detecting changes to the list/order of top level items (and then notifying Tree).

Note that Tree DnD won't work with ItemFileWriteStore? and nested data (rather than _reference). See #5786 about that.

Fixes #4544, #4977, #5560, refs #5536

!strict

comment:5 Changed 12 years ago by bill

(In [12417]) Update Tree tests to explicitly instantiate ForestStoreDecorator?. Refs #4544, #4977, #5560, #5536.

Note: See TracTickets for help on using tickets.