0

我正在使用 FancyTree 2.6.0。树在大多数情况下都工作得很好,除非我想使用 loadKeyPath 函数遍历特定的惰性节点。我收到以下错误:

Error: Fancytree assertion failed   
...,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFuncti...
jquery....11.1.js (line 2, col 1808)

我正在使用以下代码遍历键路径。

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

它可以很好地扩展已加载的节点,但是当它必须加载惰性节点时出现错误。它从服务器获取的数据如下所示。错误发生在它接收到数据之后。

[{"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"}]

我已经花了几个小时试图让它工作,但如果这不起作用,我担心我可能不得不回到 dynatree。我真的很喜欢花式树,但只是这一个问题让我退缩了。

任何帮助,将不胜感激。

谢谢

4

1 回答 1

3

好的,我通过移动 setExpanded() 函数调用解决了这个问题。

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

});
于 2014-12-08T16:53:17.700 回答