1 /*******************************checkbox按钮 历史报警信息**************************************/
var checkboxHistoryModule = new Ext.form.Checkbox({
id : "alarmHistoryInfoCheck",
name : "alarmHistoryInfoCheck",
//width : 70,
boxLabel : "历史报警信息",
//checked : true,
handler: function() {
//当选中和取消历史信息时,动态加载grid列头及数据信息,选中历史信息时,加载列多出处理人和处理时间两列
if(this.checked==true) {
var queryAlarmInfoHis_store = Ext.create('Ext.data.Store', {
autoLoad: true,
pageSize: 50,
model: 'queryAlarmInfoHistoryData',
proxy: {
type: 'ajax',
url: 'queryAlarmInfo.do',
extraParams : {
isShowHistory : "true"
},
reader: {
type: 'json',
root: 'dataList',
totalProperty: 'total'
}
}
}); var queryAlarmInfoHis_columns =
[{ text: '序号', xtype:'rownumberer', width: 40 },
{ text: '拓扑图', dataIndex: 'link',flex:1},
{
text: '工作流ID',
dataIndex: 'iflowid',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '工程名称',
dataIndex: 'prjName',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '工作流名',
dataIndex: 'flowName',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '活动名',
dataIndex: 'actName',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '报警类型',
dataIndex: 'type',
width:80,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '报警描述',
dataIndex: 'warnDes',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '报警时间',
dataIndex: 'warnTime',
width:80,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}
},
{ text: '处理描述', dataIndex: 'delDes',width:80},
{
text: '处理人',
dataIndex: 'delUser',
width:80,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}
},
{
text: '处理时间',
dataIndex: 'delTime',
width:80,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}
}
]; //重载gridpanel列信息的方法
queryAlarmInfo_grid.reconfigure(queryAlarmInfoHis_store,queryAlarmInfoHis_columns); } else {
var queryAlarmInfoNotHis_store = Ext.create('Ext.data.Store', {
autoLoad: true,
pageSize: 50,
model: 'queryAlarmInfoData',
proxy: {
type: 'ajax',
url: 'queryAlarmInfo.do',
extraParams : {
isShowHistory : "false"
},
reader: {
type: 'json',
root: 'dataList',
totalProperty: 'total'
}
}
}); var queryAlarmInfoNotHis_columns =
[{ text: '序号', xtype:'rownumberer', width: 40 },
{ text: '拓扑图', dataIndex: 'link',flex:1},
{
text: '工作流ID',
dataIndex: 'iflowid',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '工程名称',
dataIndex: 'prjName',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '工作流名',
dataIndex: 'flowName',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '活动名',
dataIndex: 'actName',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '报警类型',
dataIndex: 'type',
width:80,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '报警描述',
dataIndex: 'warnDes',
flex:1,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{
text: '报警时间',
dataIndex: 'warnTime',
width:80,
// 鼠标悬浮提醒
renderer : function (value, metaData, record, colIndex, store, view)
{
metaData.tdAttr = 'data-qtip="' + value + '"';
return value;
}},
{ text: '处理描述', dataIndex: 'delDes',width:80}
]; queryAlarmInfo_grid.reconfigure(queryAlarmInfoNotHis_store,queryAlarmInfoNotHis_columns); }
}
});

以上代码片段是动态随需求改变gridpanel列头及显示信息的方法,个人总结,如转载,请注明出处,谢谢

05-11 22:27