ExtonReady(function () {
var data = [{}];
var data2 = [{OFF_PERIOD:'2013-09',QUOTANO:'YS1100',QUOTANAME:'    主营业务收入',},{OFF_PERIOD:'2013-09',QUOTANO:'YS1200',QUOTANAME:' 通信服务收入'}];
var varItems =[{
text: '指标ID',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'QUOTANO'
}, {
text: '指标名称',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'QUOTANAME'
}, {
text: '数据ID',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'QUOTAVALUENO'
}, {
text: '数据名称',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'QUOTAVALUENAME'
}, {
text: '本部',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'BENBU',
field: {
xtype: 'numberfield'
}
}, {
text: '济南',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'JINAN',
field: {
xtype: 'numberfield'
}
}];
var varItems2 =[{
text: '指标ID',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'QUOTANO'
}, {
text: '指标名称',
//width: 200,
sortable: false,
hidden: false,
dataIndex: 'QUOTANAME'
}];
var varfields =[
{ name: 'OFF_PERIOD', mapping: 'OFF_PERIOD', type: 'string' },
{ name: 'QUOTANO', mapping: 'QUOTANO', type: 'string' },
{ name: 'QUOTANAME', mapping: 'QUOTANAME', type: 'string' },
{ name: 'QUOTAVALUENO', mapping: 'QUOTAVALUENO', type: 'string' },
{ name: 'QUOTAVALUENAME', mapping: 'QUOTAVALUENAME', type: 'string' },
];
var varfields2 =[
{ name: 'OFF_PERIOD', mapping: 'OFF_PERIOD', type: 'string' },
{ name: 'QUOTANO', mapping: 'QUOTANO', type: 'string' },
{ name: 'QUOTANAME', mapping: 'QUOTANAME', type: 'string' }
];
var vardate = Extcreate('ExtformDateField', {
fieldLabel: '账期',
labelWidth: 50,
name: 'Off_period',
maxValue: new Date(),
value: new Date(),
format: 'Y-m'
});
var northPanel = Extcreate('ExtformPanel', {
region: 'north',
layout: {
columns: 3,
type: 'table'
},
height: 55,
title: '业务管理',
items: [
vardate,
{
xtype: 'button',
anchor: '100%',
width: 75,
text: '查询',
handler: function () {
var Store = Extcreate('ExtdataStore', {
fields:varfields2,
data: data2
});
centerPanelreconfigure(Store, varItems2); //定义grid的store和column
}
},
{
xtype: 'button',
anchor: '100%',
width: 75,
text: '查询2',
handler: function () {
var Store = Extcreate('ExtdataStore', {
fields:varfields,
data: data
});
centerPanelreconfigure(Store, varItems); //定义grid的store和column
}
}
]
});
var centerPanel = Extcreate('ExtgridPanel', {
region: 'center',
title: '业务管理',
height: 55,
columns:[]
});
Extcreate('ExtcontainerViewport', {
layout: 'border',
renderTo: ExtgetBody(),
items: [northPanel, centerPanel]
});
});你采用的是layout布局是border 即 上north 下south 左left 右right 中center , 但你后两个panel的region一个是west,一个是center所以有问题,把west改为south,试试吧
listeners : {
dblclick : {
element : 'body',
fn : function() {
var _record = smgetSelection();
scount = _recordlength;
if (scount == 0) {//未选择
ExtMsgalert('友情提示', '请选择!');
return false;
}
addTab(false);
}
}
},
-------------------
function addTab (closable) {
++index;
tabsadd({
title: 'New Tab ' + index,
iconCls: 'tabs',
html: 'Tab Body ' + index + '<br/><br/>' + ExtexamplebogusMarkup,
closable: !!closable
})show();
}ExtonReady(function() {
var sm=new ExtgridCheckboxSelectionModel();
var cm=[new ExtgridRowNumberer(),sm,
{header:"编号", dataIndex:"id", width:65,hidden : true},
{header:"名称", dataIndex:"name", width:65},
{header:"路径", dataIndex:"url", width:65}
]
var fd = ["id", "name", "url"];
var store=new ExtdataJsonStore({
fields:fd
})
var data=[{
id:1,name:"xiao",url:"sssssssssss",sex:"male"
}]
var grid=new ExtgridGridPanel({
sm:sm,
columns:cm,
store:store,
width:500,
height:400,
tbar:[{
text:"生成",
icon:"images/icons/addpng",
cls:"x-btn-text-icon",
handler:function(){
var res = {fields:[{name:"sex"}],columns:[{header:'性别',dataIndex:"sex",width:65}]};
var columns = rescolumns;
var fields = resfields;
for (var i = 0; i < fieldslength; i++) {
fdpush(fields[i]name);
cmpush(columns[i]);
}
//重新绑定store及column
ss=new ExtdataJsonStore({
fields:fd
});
gridreconfigure(ss,new ExtgridColumnModel(cm));
ssloadData(data)
}
}]
})
var win=new ExtWindow({
title:"sssssss",
width:700,
height:500,
layout:"fit",
closable:true,
items:[grid]
})
winshow();
});
主要是grid里的reconfigure这个方法:配置grid以使用一个不同的Store和Column Model并触发'reconfigure'事件。 视图将会被绑定到新的对象并刷新。
你自己引用ext3的类库吧~
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)