码迷,mamicode.com
首页 > Web开发 > 详细

Extjs 4 tabpanel动态加载reconfigure的grid

时间:2015-06-04 17:37:12      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:tabpanel动态添加lockedgrid

Ext.onReady(function(){

var store = Ext.create(‘Ext.data.Store‘,{

fields : [‘name‘, ‘seniority‘, ‘department‘],

groupField : ‘department‘,

data:{‘employees‘:[{"name":"Michael", "seniority":7, "department":"Sales"}]},

proxy : {

type:‘memory‘,

reader : {

type : ‘json‘,

root : ‘employees‘

}

}

});


var columns = [{text:‘Name‘, dataIndex:‘name‘,locked:true},

{text:‘Seniority‘, dataIndex:‘seniority‘}];


var grid = Ext.create(‘Ext.grid.Panel‘,{

title : ‘Employees‘,

enableLocking : true,

columns : [],

features:[{

ftype : ‘grouping‘

}],

width : 200,

resizable : true,

store : Ext.create(‘Ext.data.Store‘,{

fields : []

}),

height : 275

});


var tab = Ext.create(‘Ext.tab.Panel‘,{

width : 400,

height : 400,

renderTo : document.body,

items : []

});


var button = Ext.widget(‘button‘,{

renderTo : Ext.getBody(),

text : ‘rec‘,

handler : function(){

tab.add(grid);

grid.reconfigure(store, columns);

}

});

});

-----------------------------------------------------------------------------------

handler里面如果reconfigure放在add的前面就会出现el找不到的错误。

Extjs 4 tabpanel动态加载reconfigure的grid

标签:tabpanel动态添加lockedgrid

原文地址:http://angelgirl.blog.51cto.com/1695763/1658376

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!