cheton / infinite-tree

A browser-ready tree library that can efficiently display a large amount of data using infinite scrolling.
https://infinite-tree.js.org
MIT License
168 stars 38 forks source link

tree.openNode function is not working for a node while updating tree data via tree.loadData function #57

Open itsanmax opened 4 years ago

itsanmax commented 4 years ago

I've a scenario where L2(Child) level tree structure is opened. Clicking on L2 context menu icon, which do something and switching context menu icon to some other icon. To do this, managing a flag variable at each node to show the corresponding icon at particular node level and after updating this flag data with each node, need to re-render the tree so that as per corresponding flag variable, context icon appear at DOM.

Getting below issues after updating tree data:

My full code is as per below:

// load updated tree data
that.tree.loadData(that.props.treeconfig.listOfContanier);
// getting parent node L1 level
let parentNode = that.props.selectedNode;
const { tree } = that.treeRef.current;
// Below code should open referred node and child nodes should appear as it has child data. But seems not working so
tree.openNode(parentNode);

Does anyone run into the such kind of issues? Any help would be appreciated.

itsanmax commented 3 years ago

Seems no one is looking into this. Kindly help if anyone faced this issue and having any work around solutions.