extJS4 树子项直到单击"排序"标题按钮才显示



我callled root.appendchild()将几个孩子添加到treepanel root并称为root.expand()以展开树,但是在我单击任何一个之前,孩子节点没有显示标题上的排序按钮。我需要设置任何属性来编程显示子节点吗?

感谢您的帮助。

以下是代码:

        tree.getRootNode().removeAll();
        var root = tree.setRootNode({
            PRTNUM:'root',
            id: 'treeRoot',
            leaf: false
        });
        for (var i = 0; i < result.data.length; i++) {
            var rec = result.data[i];
            var node = root.appendChild({
                PRTNUM: rec.PRTNUM,
                DESC: rec.DESC,   
                icon: this.convertTypeToIcon(rec.TYPE),
                id: rec.PRTNUM,
                leaf: true
            });
        }

        root.expand();

由于您的根节点最初没有孩子,因此被标记为叶子。我发现以下适用于最初留下的父节点,您必须以编程方式添加节点:

parentNode.set("leaf", false);  //must be set to work properly
parentNode.appendChild(newChild);
parentNode.expand();

我发现,在调用appendchild()fix fix thie'thie'thie'thie'thie'the''the'''''stort''列列按钮之后,添加以下几行不会扩展。谢谢。

        root.expandChildren(true);
        root.sort(function() {});

最新更新