patternfly-bootstrap-treeview
patternfly-bootstrap-treeview copied to clipboard
updateNode hides node from view
I'm writing code to make the "tag" reflect the number of children that have been "checked". The last method call of my function is to update the node of the treeView to get the tag to update, but after that call, the node (and its parent) disappears. Here is my code:
onNodeChecked: function (event, node) {
console.log("node checked " + node.text);
var p = tab2data.treeView.getParents(node)[0];
if (!p.dataAttr) {
p.dataAttr = {};
p.dataAttr.selected = 0;
}
if (!p.tags) {
p.tags = [];
}
p.tags[0] = p.dataAttr.selected++ + " checked";
tab2data.treeView.updateNode(p, p);
}
Hi,
I think you should do a deep copy of the p
variable and edit that in the further steps. Then when you changed all the things, update the p
with the copied+edited.