ExtJs学习笔记1

    <script type="text/javascript">
        Ext.onReady(function () {
            var root = new Ext.tree.AsyncTreeNode({
                text: "根节点",
                id: "-1",
                children: [{ text: "子节点1", id: "1",leaf:true },{text: "子节点1", id: "1",leaf:true}]
            })
            var tree = new Ext.tree.TreePanel({
                height: 10000,
                renderTo:"div1"
                width: 1000,
                title: "我的第一课树",
                root: root,
                loader: new Ext.tree.TreeLoader()
            });
        });
    </script>

 

<div id="div1"></div>

显示一棵树的时候,我们可以通过

从后台获取json数据绑定children配置项里

还有注意的一点:加上loader: new Ext.tree.TreeLoader()配置项,虽然我到现在都不明白为什么要加上这个?

但不加上的话,显示不了树

posted @ 2011-09-12 12:57  walleyekneel  阅读(153)  评论(0编辑  收藏  举报