博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ExtJS之 Tree
阅读量:5914 次
发布时间:2019-06-19

本文共 1803 字,大约阅读时间需要 6 分钟。

简单例子:

var store = Ext.create('Ext.data.TreeStore', {

               root: {
                   expanded: true,
                   text: "",
                   user: "",
                   status: "",
                   children: [
           { text: "detention", leaf: true },
           { text: "homework", expanded: true,
               children: [
                   { text: "book report", leaf: true },
                   { text: "alegrbra", leaf: true }
               ]
           },
           { text: "buy lottery tickets", leaf: true }
       ]
               }
           });

           Ext.create('Ext.tree.Panel', {

               title: 'Simple Tree',
               width: 200,
               height: 150,
               store: store,
               rootVisible: true,
               renderTo: Ext.getBody()
           });

多列树:

Ext.create('Ext.tree.Panel', {

              title: 'Simple Tree',
              width: 400,
              height: 300,

              rootVisible: true,

              renderTo: Ext.getBody(),
              useArrows: true,
              fields: ['name', 'description'],
              columns: [

              {

                  xtype: 'treecolumn',
                  text: '名称',
                  dataIndex: 'name',
                  flex: 1,
                  sortable: true

              },
              {
                  text: '描述',
                  dataIndex: 'description',
                  flex: 1,
                  sortable: true
              }
              ],
              root: {
                  name: 'sss',
                  description: '树根描述',
                  expanded: true,
                  text: "asd",
                  user: "",
                  status: "",
                  children: [
          { name: "detention", leaf: true },
          { name: "homework", expanded: true, description: 'sss',
              children: [
                  { name: "book report", leaf: true, description: 'book表述' },
                  { name: "alegrbra", leaf: true, description: 'asdasd' }
              ]
          },
          { name: "buy lottery tickets", leaf: true }
      ]
              }

          });

分级加载树节点

Ext.regModel('Info', {

                fields: ['iid', 'name', 'count']

            });

            var store = new Ext.data.TreeStore({

                model: 'Info',

                nodeParam: 'iid',
                proxy: {

                    type: 'ajax',

                    url: 'Handler.ashx',
                    reader: 'json'

                },

                autoLoad: true,
                root: {
                    name: 'root',
                    id: '-1'

                }

            })

            Ext.create('Ext.tree.Panel', {

                title: 'demo',

                renderTo: Ext.getBody(),
                width: 300,
                height: 500,
                columns: [{
                    xtype: 'treecolumn',
                    text: 'cname',
                    dataIndex: 'name',
                    width: 200,
                    sortable: true
                }, {
                    text: 'pcount',
                    dataIndex: 'count',
                    flex: 1,
                    sortable: true

                }

                        ],

                store: store,
                rootVisable: false

            })

转载于:https://www.cnblogs.com/Mr-Joe/archive/2012/03/01/2375773.html

你可能感兴趣的文章
linux系统中top命令输出详解
查看>>
cURL: Learning..
查看>>
540. Single Element in a Sorted Array(有序数组的 Single Element)(leetcode)
查看>>
Codeforces Round #219 (Div. 1) A. Counting Kangaroos is Fun 【二分】
查看>>
Html基础
查看>>
wiki----为用户设置管理员权限
查看>>
Codeforces Round #565 (Div. 3) A. Divide it!
查看>>
《图像处理实例》 之 局部极值提取
查看>>
【leetcode】993. Cousins in Binary Tree
查看>>
java 常见几种发送http请求案例[转]
查看>>
更改Visual Studio 2010/2012/2008的主题设置
查看>>
win7系统安装hadoop
查看>>
day5作业购物商城+ATM
查看>>
day6作业--选课系统
查看>>
stegsolve---图片隐写查看器
查看>>
dubbo接口测试
查看>>
Maven生命周期详解(转)
查看>>
uoj#401. 【CTSC2018】青蕈领主(分治FFT)
查看>>
jvm -Xms -Xmx
查看>>
bash的pushd和popd
查看>>