root A
root B
--- element AA
root C
--- element AA
--- element AB
root D
root E
Also tried moving root E up in between element AA and element AB with similar result.
root A
root B
--- element AA
root C
--- element AA
--- element AB
--- element AC
root D
I did verify that the underlying data structure was as expected and that fetching nodes were the nodes desired. When bypassing the above and simply calling treeView.resetTree(), everything worked as expected (except that the expanded nodes were now collapsed).
I believe the trouble lies in the insertNode function(s).
Any help would be greatly appreciated as I would really like to use this great tool.
Here are two scenarios for comparison:
Root Scenario
root A root B root C root D root E
Task is to move root D up in between root A and root B. I adjust the data structure, then perform:
let node = (get the node for root D) let indexPath = IndexPath(row: 1, section: 0)
treeView.removeNode(withIdentifier: node.identifier, inSection: 0) treeView.insertNode(at: indexPath, inParent: nil)
All works as expected.
Tree Scenario
root A root B root C --- element AA --- element AB --- element AC root D root E
Task is to move element AC up in between element AA and element AB. I adjust the data structure, then perform:
let node = (get the node for element AC) let parent = (get the node for root C) let indexPath = IndexPath(row: 1, section: 0)
treeView.removeNode(withIdentifier: node.identifier, inSection: 0) treeView.insertNode(at: indexPath, inParent: parent)
and the following occurs:
root A root B --- element AA root C --- element AA --- element AB root D root E
Also tried moving root E up in between element AA and element AB with similar result.
root A root B --- element AA root C --- element AA --- element AB --- element AC root D
I did verify that the underlying data structure was as expected and that fetching nodes were the nodes desired. When bypassing the above and simply calling treeView.resetTree(), everything worked as expected (except that the expanded nodes were now collapsed).
I believe the trouble lies in the insertNode function(s).
Any help would be greatly appreciated as I would really like to use this great tool.