extjs4.2里还有没有columnModel?我想做动态加载表格,就是列会变化的。 30
网上的方法都是用columnModel和grid.reconfigure实现的,可在ext4.2里用不了,有没有其他方法,求高人打错了,是extjs4.1...
网上的方法都是用columnModel和grid.reconfigure实现的,可在ext4.2里用不了,有没有其他方法,求高人
打错了,是extjs4.1 展开
打错了,是extjs4.1 展开
展开全部
Ext.require(['*']);
Ext.onReady(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 = Ext.create('Ext.form.DateField', {
fieldLabel: '账期',
labelWidth: 50,
name: 'Off_period',
maxValue: new Date(),
value: new Date(),
format: 'Y-m'
});
var northPanel = Ext.create('Ext.form.Panel', {
region: 'north',
layout: {
columns: 3,
type: 'table'
},
height: 55,
title: '业务管理',
items: [
vardate,
{
xtype: 'button',
anchor: '100%',
width: 75,
text: '查询',
handler: function () {
var Store = Ext.create('Ext.data.Store', {
fields:varfields2,
data: data2
});
centerPanel.reconfigure(Store, varItems2); //定义grid的store和column
}
},
{
xtype: 'button',
anchor: '100%',
width: 75,
text: '查询2',
handler: function () {
var Store = Ext.create('Ext.data.Store', {
fields:varfields,
data: data
});
centerPanel.reconfigure(Store, varItems); //定义grid的store和column
}
}
]
});
var centerPanel = Ext.create('Ext.grid.Panel', {
region: 'center',
title: '业务管理',
height: 55,
columns:[]
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
renderTo: Ext.getBody(),
items: [northPanel, centerPanel]
});
});
Ext.onReady(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 = Ext.create('Ext.form.DateField', {
fieldLabel: '账期',
labelWidth: 50,
name: 'Off_period',
maxValue: new Date(),
value: new Date(),
format: 'Y-m'
});
var northPanel = Ext.create('Ext.form.Panel', {
region: 'north',
layout: {
columns: 3,
type: 'table'
},
height: 55,
title: '业务管理',
items: [
vardate,
{
xtype: 'button',
anchor: '100%',
width: 75,
text: '查询',
handler: function () {
var Store = Ext.create('Ext.data.Store', {
fields:varfields2,
data: data2
});
centerPanel.reconfigure(Store, varItems2); //定义grid的store和column
}
},
{
xtype: 'button',
anchor: '100%',
width: 75,
text: '查询2',
handler: function () {
var Store = Ext.create('Ext.data.Store', {
fields:varfields,
data: data
});
centerPanel.reconfigure(Store, varItems); //定义grid的store和column
}
}
]
});
var centerPanel = Ext.create('Ext.grid.Panel', {
region: 'center',
title: '业务管理',
height: 55,
columns:[]
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
renderTo: Ext.getBody(),
items: [northPanel, centerPanel]
});
});
展开全部
Ext现在还没有动态列的解决方案
思路:我在实现动态列的时候先用的Ajax进行后台请求 后台返回一个grid列名和dataIndex的集合,前台使用返回值来重新创建grid
思路:我在实现动态列的时候先用的Ajax进行后台请求 后台返回一个grid列名和dataIndex的集合,前台使用返回值来重新创建grid
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
重新生成grid吧,比单纯替换列慢不了多少,当然,如果你数据不需要重新load就最好不用这种方法了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
50javascript转换hex到UTF16 再将utf16转换到utf8
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询