• extjs4 tree


    一、树面板简单示例

    Javascript代码 复制代码 收藏代码
    1. var tree = Ext.create('Ext.tree.Panel', {   
    2.     title: '树面板简单示例',   
    3.     width : 150,   
    4.     height : 100,   
    5.     renderTo: Ext.getBody(),   
    6.     root: {   
    7.         text: '树根',//节点名称   
    8.         expanded: true,//默认展开根节点   
    9.         children: [{   
    10.             text: '节点一',//节点名称   
    11.             leaf: true//true说明为叶子节点   
    12.         }, {   
    13.             text: '节点二',//节点名称   
    14.             leaf: true//true说明为叶子节点   
    15.         }]   
    16.     }   
    17. });  
    var tree = Ext.create('Ext.tree.Panel', {
    	title: '树面板简单示例',
    	width : 150,
    	height : 100,
    	renderTo: Ext.getBody(),
    	root: {
    	    text: '树根',//节点名称
    	    expanded: true,//默认展开根节点
    	    children: [{
    	        text: '节点一',//节点名称
    	        leaf: true//true说明为叶子节点
    	    }, {
    	        text: '节点二',//节点名称
    	        leaf: true//true说明为叶子节点
    	    }]
    	}
    });



    二、多列树示例

    Javascript代码 复制代码 收藏代码
    1. var tree = Ext.create('Ext.tree.Panel', {   
    2.     title: 'TreeGrid(多列树示例)',   
    3.     renderTo: Ext.getBody(),   
    4.     width : 200,   
    5.     height : 120,   
    6.     fields: ['name''description'],   
    7.     columns: [{   
    8.         xtype: 'treecolumn',//树状表格列   
    9.         text: '名称',   
    10.         dataIndex: 'name',   
    11.          100,   
    12.         sortable: true  
    13.     }, {   
    14.         text: '描述',   
    15.         dataIndex: 'description',   
    16.         flex: 1,   
    17.         sortable: true  
    18.     }],   
    19.     root: {   
    20.         name: '树根',   
    21.         description: '树根的描述',   
    22.         expanded: true,   
    23.         children: [{   
    24.             name: '节点一',   
    25.             description: '节点一的描述',   
    26.             leaf: true  
    27.         }, {   
    28.             name: '节点二',   
    29.             description: '节点二的描述',   
    30.             leaf: true  
    31.         }]   
    32.     }   
    33. });  
    var tree = Ext.create('Ext.tree.Panel', {
        title: 'TreeGrid(多列树示例)',
        renderTo: Ext.getBody(),
        width : 200,
        height : 120,
        fields: ['name', 'description'],
        columns: [{
            xtype: 'treecolumn',//树状表格列
            text: '名称',
            dataIndex: 'name',
             100,
            sortable: true
        }, {
            text: '描述',
            dataIndex: 'description',
            flex: 1,
            sortable: true
        }],
        root: {
            name: '树根',
            description: '树根的描述',
            expanded: true,
            children: [{
                name: '节点一',
                description: '节点一的描述',
                leaf: true
            }, {
                name: '节点二',
                description: '节点二的描述',
                leaf: true
            }]
        }
    });



    三、树面板中的复选框示例

    Javascript代码 复制代码 收藏代码
    1. var tree = Ext.create('Ext.tree.Panel', {   
    2.     title: '复选框示例',   
    3.     width : 150,   
    4.     height : 100,   
    5.     renderTo: Ext.getBody(),   
    6.     root: {   
    7.         text: '树根',//节点名称   
    8.         expanded: true,//默认展开根节点   
    9.         children: [{   
    10.             text: '节点一',//节点名称   
    11.             checked : true,//默认选中   
    12.             leaf: true//true说明为叶子节点   
    13.         }, {   
    14.             text: '节点二',//节点名称   
    15.             checked : false,//默认不选中   
    16.             leaf: true//true说明为叶子节点   
    17.         }]   
    18.     }   
    19. });  
  • 相关阅读:
    Conference deadlines
    waiting list
    BDA3 Chapter 1 Probability and inference
    PP: Articial Intelligence—TheRevolution Hasn’t HappenedYet
    兼容ie9文件上传,及现代浏览器实现进度条
    input 打开文件夹事件委托
    前端构建工具gulpjs的使用介绍及技巧
    如何编写兼容各主流邮箱的HTML邮件
    前端通用框架可行性研究报告之弹窗
    切换tab键,不聚焦a标签
  • 原文地址:https://www.cnblogs.com/luluping/p/2243777.html
Copyright © 2020-2023  润新知