admin
管理员
管理员
  • UID1
  • 粉丝2
  • 关注2
  • 发帖数339
  • 社区居民
  • 忠实会员
  • 原创写手
阅读:6142回复:0

extjs树形结构

楼主#
更多 发布于:2014-01-03 00:48
分享到:
http://blog.csdn.net/yangxiaojun9238/article/details/8222743
Ext.define('KitchenSink.view.tree.CheckTree', {
    extend: 'Ext.tree.Panel',
       
    requires: [
        'Ext.data.TreeStore'
    ],
    xtype: 'check-tree',
    rootVisible: false,
    useArrows: true,
    frame: true,
    title: 'Check Tree',
    width: 250,
    height: 300,
    //autoLoad:true,
    initComponent: function(){
   
        Ext.apply(this, {
            store: new Ext.data.TreeStore({
                proxy: {
                    type: 'ajax',
                    url: 'check-nodes.json'
                },
                sorters: [{
                    property: 'leaf',
                    direction: 'ASC'
                }, {
                    property: 'text',
                    direction: 'ASC'
                }]
            }),
            tbar: [{
                text: 'Get checked nodes',
                scope: this,
                handler: this.onCheckedNodesClick
            }]
        });
        this.callParent();
    },
       
    onCheckedNodesClick: function(){
        var records = this.getView().getChecked(),
            names = [];
                      
        Ext.Array.each(records, function(rec){
            names.push(rec.get('text'));
        });
                       
        Ext.MessageBox.show({
            title: 'Selected Nodes',
            msg: names.join(''),
            icon: Ext.MessageBox.INFO
        });
    }
});
var Tom = Ext.create("KitchenSink.view.tree.CheckTree", {
xtype: 'check-tree',
    rootVisible: false,
    useArrows: true,
    frame: true,
    title: 'Check 111Tree',
    width: 250,
    height: 1000,
    renderTo: Ext.getBody()
});
游客

返回顶部