• 使用Ext 创建树


    ext使用的是ext3.4.0版本

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
        <title>Hello-Ext</title>
        <link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
        <script type="text/javascript" src="ext/adapter/ext/ext-base.js" ></script>
        <script type="text/javascript" src="ext/ext-all.js" ></script>
        <script type="text/javascript" src="js/win.js" ></script>
        <script type="text/javascript" >
            /*Ext.onReady(function () {
                var win = new Ext.Window({
                     600,
                    height: 500,
                    title: "测试窗口",
                    buttons: [{ text: "确定" }, {text:"取消"}]
                });
    
                win.show();
            });*/
        </script>
    </head>
    <body>
    
    </body>
    </html>
    View Code

    ext创建树的脚本

    function ShowWindow() {
        //调用button的on方法设置监听函数
        var btn = new Ext.Button({
            text: "创建一个窗口"
        });
        btn.on("click", ShowMinWindow);
    
        var win = new Ext.Window({
             500,
            height: 300,
            title: "My Ext Window",
            maximizable: true,
            minimizable: true,
            maximize: function () { win.hide(); },
            buttons: [{ text: "创建一个带数的窗口",
                listeners: {
                    click: function () {
                        var tree = new Ext.tree.TreePanel({
    
                             500,
                            height: 300,
                            title: "树的测试",
                            root: new Ext.tree.AsyncTreeNode({
                                text: "子节点1",
                                children: [{ text: "子节点11", children: [{ text: "子节点111", leaf: true}] }, { text: "子节点2", leaf: true}]
                            })
                        });
    
                        var w1 = new Ext.Window({
                             300,
                            height: 400,
                            title: "树",
                            items: [tree]
                        });
                        //w1.add(tree);
                        w1.show();
                    }
                }
            }, btn]
        });
        win.show();
    }
    
    function ShowMinWindow() {
        var win = new Ext.Window({
            200,
            height: 100,
            title:"弹出窗口"
        });
        win.show();
    }
    
    Ext.onReady(ShowWindow);
    View Code

    效果如下图

  • 相关阅读:
    最短路问题
    树的最小支配集,最小点覆盖与最大独立集
    最近公共祖先(LCA)
    图的生成树
    图的遍历
    图的存储结构
    博客园总算支持Markdown了
    关于VMware(虚拟机) 出现错误时处理办法
    Docker 部署 _实现每日情话 定时推送(apscheduler)
    tkinter + 爬虫 实现影视在线资源系统
  • 原文地址:https://www.cnblogs.com/ZJ199012/p/4184592.html
Copyright © 2020-2023  润新知