Reputation: 1276
I am using FancyTree 2.6.0. Tree works very well for most part except when I want to traverse to a specific lazy node using loadKeyPath function. I get following error:
Error: Fancytree assertion failed
...,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFuncti...
jquery....11.1.js (line 2, col 1808)
I am using following code to traverse to a keypath.
tree.loadKeyPath(treePath, function(node, status)
{
console.log("Node ["+node.title+"] status ["+status+"]");
node.data.shouldPromptForFilter=false;
if (status == "loading")
node.data.shouldPromptForFilter=false;
else if (status == "loaded")
{
console.log("intermediate node " + node);
node.setExpanded(true);
}
else if (status == "ok")
node.setActive(true);
});
It expands already loaded nodes just fine but i get error when it has to load lazy nodes. The data it fetched from the server looks like this. The error occurs after it receives the data.
[{"isRoot":"false","lazy":false,"tooltip":"evil-kirk.goldenrod.trek.dms.","childCount":"0","isElipsis":"false","shouldPromptForFilter":"true","title":"evil-kirk.goldenrod.trek.dms.","key":"e4d17462-64c2-4215-9097-7f91480f8c0c","status":"0"}]
I have spent few hours already on this trying to make it work but I am afraid I might have to go back to dynatree if this does not work. I really like fancytree but just this one issue kinda setting me back.
Any help would be appreciated.
Thanks
Upvotes: 0
Views: 1160
Reputation: 1276
OK I solved the problem by moving setExpanded() function call.
tree.loadKeyPath(treePath, function(node, status)
{
console.log("Node ["+node.title+"] status ["+status+"]");
if (status == "loading")
node.data.shouldPromptForFilter=false;
else if (status == "loaded")
{
console.log("intermediate node " + node);
}
else if (status == "ok")
{
node.setExpanded(true);
node.setActive(true);
});
Upvotes: 3