patternfly-bootstrap-treeview icon indicating copy to clipboard operation
patternfly-bootstrap-treeview copied to clipboard

updateNode hides node from view

Open vzlatkin opened this issue 7 years ago • 1 comments

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);
}

vzlatkin avatar Nov 13 '17 02:11 vzlatkin

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.

skateman avatar Nov 19 '17 13:11 skateman