Opened 5 years ago

Closed 3 years ago

#18069 closed enhancement (fixed)

[patch][cla][pr][verify test] Have Observable work with relational data

Reported by: Wouter Hager Owned by: dylan
Priority: high Milestone: 1.10.5
Component: Data Version: 1.10.1
Keywords: Cc:
Blocked By: Blocking:


Since recent changes in dijit/tree/ObjectStore, working with many-to-many relationships in a tree has been most successful. There remains only one problem: when removing only the relationship to one node, its duplicates are removed in every branch. This is because in Observable expects a 1-to-many relationship, and there's no check for the origin of removed items.

Short explanation: in my model, nodes can be duplicated in the tree by adding intermediary relationships (many-to-many). These can be removed by passing a custom relationshipOnly option to store.remove(). I think the tree store should be agnostic of relationship management, so I see no other way to do this.

The problem is on line 79:

if(queryExecutor || !changed){// if it was changed and we don't have a queryExecutor, we shouldn't remove it because updated objects would be eliminated
resultsArray.splice(i, 1);

This will simply remove every object passed through store.remove() from the resultsArray by its identity.

I think the way to solve this is to requery the data before removing the object, in the same manner as is done for changing objects. I don't have a proposal where to fit this in, so I will leave that open.

Change History (5)

comment:1 Changed 5 years ago by Wouter Hager

I created a pull request that will provide me with a minimal mechanism to deal with this issue:

comment:2 Changed 5 years ago by dylan

Component: GeneralData
Milestone: tbd1.11
Owner: set to Kris Zyp
Priority: undecidedhigh
Status: newassigned
Version: 1.10.0-beta11.10.1

comment:3 Changed 4 years ago by dylan

Owner: changed from Kris Zyp to dylan

comment:4 Changed 3 years ago by dylan

Summary: Have Observable work with relational data[patch][cla][pr][verify test] Have Observable work with relational data

comment:5 Changed 3 years ago by dylan

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.