--------------------------------------布局----------------------------------
//布局管理
function createLayout(){
new Ext.Viewport({
layout:'border',
items:[{
title: '部门管理',
collapsible: true,
region:'west',
width: 100,
items:tree,
tbar:[{
id:'txt-name',
xtype:'textfield'
},{
xtype:'button',
text:'查找',
handler:searchTree
}]
},{
region:'center',
id:'tabs',
xtype:'tabpanel',
activeTab:0,
contentEl:'dms-content',
items:panels
}]
})
}
--------------------------------------panel----------------------------------
function createPanel(){
panels = Ext.extend(Ext.Panel, {
border:false,
layout:'fit',
pageSize:20, //分页大小
initComponent:function(){
panel.superclass.initComponent.call(this);
this.grid = this.createGrid(); //创建表格
//this.add(this.grid);
},
items:[{items:this.grid}],
/**
* 创建表格部件
*/
createGrid:function(){
var ds = new Ext.data.JsonStore({
url:'/KJ222Demo/Demo/getAll', //由etmvc映射到DeviceController类中的getDevices方法
fields:[
'id','code','name','other'
],
baseParams:{
limit:this.pageSize
},
totalProperty:'total',
root:'demo'
});
ds.load({
params:{start:0}
});
var grid = new Ext.grid.GridPanel({
store:ds,
columns:[
{header:'行号',renderer:function(value, cellmeta, record, rowIndex){return rowIndex + 1;}},
{header:'编号',dataIndex:'code',width:100},
{header:'名称',dataIndex:'name',width:100},
{header:'其它',dataIndex:'other',width:100}
],
tbar:[{
text:'增加',
iconCls:'tool-add'
},'-',{
text:'修改',
iconCls:'tool-edit'
// iconCls:'tool-edit',
// handler:this.editItem.createDelegate(this)
},'-',{
text:'删除',
iconCls:'tool-cut'
// iconCls:'tool-cut',
// handler:this.destroyItem.createDelegate(this)
},'-',{
text:'查询',
iconCls:'tool-find',
handler:this.showQueryWindow.createDelegate(this)
},'-',{
text:'导出到excel',
iconCls:'tool-find',
handler:this.onPrint.createDelegate(this)
}],
bbar:new Ext.PagingToolbar({
store:ds,
pageSize:this.pageSize
}),
border:false
});
//grid.render('grid-example');
//grid.getSelectionModel().selectFirstRow();
return grid;
}
});}
---------------------------------------问题------------------------------------
},{
region:'center',
id:'tabs',
xtype:'tabpanel',
activeTab:0,
contentEl:'dms-content',
items:panels
}]
items:panels
没反应
[b]问题补充:[/b]
var tree;
var panels;
已经定义了,用FF调试,到createGrid:function(){ 这里时就断掉了。
[b]问题补充:[/b]
this.grid = this.createGrid(); //创建表格
this.add(this.grid);
定义了。不管怎么调都出来了。。
郁闷