NutzCN Logo
问答 TreeTable怎么默认展开第一层?
发布于 2071天前 作者 akun 4767 次浏览 复制 上一个帖子 下一个帖子
标签:

组织机构有一个不动的根节点,想直接进入页面时显示根节点下的第一层树,应该怎么实现? (*^▽^*)

7 回复

当前的代码

        treeTable = $("#treeTable").treetable({
            expandable: true,
            onNodeExpand: function () {
                var node = this;
                var rows = "<tr data-tt-id=\"loading\" data-tt-parent-id=\"" + node.id + "\" data-tt-branch=\"false\"><td colspan='5'><img src=\"" + base + "/assets/img/loading.gif\"/>loading</td></tr>";
                treeTable.treetable("loadBranch", node, rows);
                $.post("${base}/platform/orgz/department/child/" + node.id, {}, function (data) {
                    treeTable.treetable("unloadBranch", node);
                    treeTable.treetable("loadBranch", node, data);
                });
            }
        });

@Wizzercn 自己顶下,顺便呼叫大佬

@qq_f891a053 这个问题百度一大堆结果

百度结果

        treeTable = $("#treeTable").treetable({
            indent: 20,
            expandable: true,
            isPadding:true,
            clickableNodeNames:true,
            onInitialized:function () {
                $("#treeTable").css('display','inline-table');
                $("#treeTable tr:first a").trigger('click');
            },
            onNodeExpand: function () {
                var node = this;
                var rows = "<tr data-tt-id=\"loading\" data-tt-parent-id=\"" + node.id + "\" data-tt-branch=\"false\"><td colspan='5'><img src=\"" + base + "/assets/img/loading.gif\"/>loading</td></tr>";
                treeTable.treetable("loadBranch", node, rows);
                $.post("${base}/platform/orgz/department/child/" + node.id, {}, function (data) {
                    treeTable.treetable("unloadBranch", node);
                    treeTable.treetable("loadBranch", node, data);
                });
            }
        });

然而并不管用

添加回复
请先登陆
回到顶部