patternfly / patternfly-bootstrap-treeview

Tree View for Twitter Bootstrap -
http://jonmiles.github.io/bootstrap-treeview
Apache License 2.0
200 stars 105 forks source link

select node in onRendered event callback failed. #116

Open GikkiAres opened 2 years ago

GikkiAres commented 2 years ago

select node in onRendered event callback failed.

image

Error is not initialized. But if call after 200ms,suceeded. It seems the tree is not initialized,event the render event is sended.

Relative code is here:

        onRendered: function(event, data) {
            console.log(`\nTreeView/Rendered\n`);
            let firstRootProjectNode = data[0];
            console.log(`First root project is:\n${JSON.stringify(firstRootProjectNode)}\n`);
            $('#tree').treeview('selectNode', [
                [firstRootProjectNode], { silent: false }
            ]);
        }