SmartClient Version: v9.1p_2014-07-12/Pro Deployment (built 2014-07-12)
Context TreeGrid/Tree
Hello,
In my case I have a tree that is built from a datasource. Because I use the parent model the root node is not represented in the datasource so I create this root artificially. Now there is a situation where the user can add a parent to this artificial root. In this situation the 'old' rootnode becomes the new artificial rootnode and the new object (created by the user) is put under this artificial rootnode. Because of this I need to move the children of the artificial rootnode under the new object, so I change the parentpointer of the children to the id of this new object.
Anyway when I reconstruct the tree with the modified data and do setData on the TreeGrid the children are still attached to this rootnode (one level too high) I found that this happens in the _add method under ISC_Grids.
__add in ISC_Grids:
In this method you can see that the grandChildren are added to the node through __addList. In my case if the artificial node is passed through this method than it will put the old children in the grandChildren parameter and so they are added to the root. Could it be that this method does not take any changes to the parentpointers in account? Or am I forgetting to modify something on one of the nodes?
Kind Regards,
Steven
Context TreeGrid/Tree
Hello,
In my case I have a tree that is built from a datasource. Because I use the parent model the root node is not represented in the datasource so I create this root artificially. Now there is a situation where the user can add a parent to this artificial root. In this situation the 'old' rootnode becomes the new artificial rootnode and the new object (created by the user) is put under this artificial rootnode. Because of this I need to move the children of the artificial rootnode under the new object, so I change the parentpointer of the children to the id of this new object.
Anyway when I reconstruct the tree with the modified data and do setData on the TreeGrid the children are still attached to this rootnode (one level too high) I found that this happens in the _add method under ISC_Grids.
__add in ISC_Grids:
Code:
__add : function (node, parent, position) { var pagedResultTree = ( isc.ResultTree != null && isc.isA.ResultTree(this) && this.isPaged()); ... var grandChildren = (pagedResultTree ? this._canonicalizeChildren(node, info.grandChildren, false) : info.grandChildren); if (pagedResultTree) { var fromParent = (parent[this.canReturnOpenSubfoldersProperty] != null), openSubfoldersAllowed = (fromParent ? parent[this.canReturnOpenSubfoldersProperty] : this.canReturnOpenFolders); if (!openSubfoldersAllowed && this.isOpen(node) && grandChildren != null && !grandChildren.isEmpty()) { this.logWarn( "Adding the open folder node '" + this.getPath(node) + "' as a child of the " + "parent node '" + this.getPath(parent) + "' is contradictory to the setting " + "of the " + (fromParent ? "'" + this.canReturnOpenSubfoldersProperty + "' " + "property of the parent node." : "'canReturnOpenFolders' property of the tree.")); } } var deltaLength = 0; if (pagedResultTree && isc.isA.ResultSet(grandChildren)) { if (!(grandChildren.lengthIsKnown() && grandChildren.allMatchingRowsCached())) { this._setVisibleDescendantsCached(node, false, parent, false); } } else if (grandChildren != null) { // If the node has children, recursively add them to the node. This ensures that // their parent link is set up correctly. // Handle children being specified as a single element recursively. // _add will slot the element into the new children array. if (!isc.isAn.Array(grandChildren)) { this.__add(grandChildren, node); } else if (grandChildren.length > 0) { this.__addList(grandChildren, node); }
Kind Regards,
Steven
Comment