Opened 12 years ago

Last modified 8 years ago

#5536 closed defect

Tree: provide method to set top level children — at Version 1

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

Description (last modified by bill)

It's impractical for Tree to tell if a new item or changed item in the data store should appear at the tree top level.

Assume a tree like

+ root
   - top 1
   - top 2
   - top 3

"Root" is an optionally displayed node that doesn't correspond to any item in the data store. The list of top* items is determined by Tree's query parameter.

When a new item is added to the data store, Tree has no way of knowing if it matches the query or not, without rerunning the query. It also doesn't know the sort order of the item, relative to it's siblings.

Similarly, any change to an item's attributes could potentially change it's status, so we need to rerun the query in that case too.

However, rerunning the query on every new or changed node is impractical because it's too slow. Imagine a Tree of users and groups. Since users are never top level elements in the tree, it's silly to rerun the query every time a new user is added.

Since it's impractical for Tree to solve this problem, provide method for the user to notify the tree whenever the top level children have changed, by giving the new list of children. Tree will compare the current list to the new list and add/delete nodes as necessary.

Something like setTopLevelChildren( /*[] */ items );

Change History (1)

comment:1 Changed 12 years ago by bill

Description: modified (diff)
Note: See TracTickets for help on using tickets.