Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2515
How to programmatically populate a node with children
posted

I have an igTree configured for LoadOnDemand. I've implemented the nodePopulating event to populate each node with children as I expand the node. Everything works fine.

However, I now find that I need to programmatically populate/expand some of the nodes without requiring a user to click to expand it.

In the igTree rendered event I have something like the following. Unfortunately, since each childNode is not populated, they aren't expanding. There is clearly code somewhere to initiate populating a node since a node gets populated when I click on the  expand indicator. But I can't find anything documented that tells me how I can do it programmatically.

Is there something like $tree.igTree("populate",childNode); available?

var uncheckedNodes = $tree.igTree("uncheckedNodes");
uncheckedNodes.forEach(function (child, i) {
var childNode = child.element;
if (i < 3) {
$tree.igTree("expand",childNode);
}
});