我一个页面中需要 进行19张表的查询,为了方便使用,采用动态生成grid头和内容,一次只能查询一张表的数据,也就是用的select,但现在的问题是,第一张表数据可以正常显示,而且不论怎么点都不会有错,但是如果再查看任意一张表,就会出现'this.getRow(...)' 为空或不是对象 错误代码如下
var cm,ds;
Ext.Ajax.request({
timeout:600000,
url:'syssjcxList.action',
params:{json:Ext.encode(json)},
failure: function(response,options){
return;
},
success: function(response,options){
var res = Ext.decode(response.responseText);
var heads = res.heads;
var fileids = res.fileids;
var colMArray = new Array();
var dsroot = new Array();
var divWidth = Ext.getDom("message").clientWidth;
var divHeight = Ext.getDom("message").clientHeight;
var gridWidth = divWidth*98/100;
var theWidth = gridWidth/(heads.length);
for(var i = 0;i<heads.length;i++){
colMArray[i] = {header:heads[i],width: theWidth,dataIndex:fileids[i]}
}
cm = new Ext.grid.ColumnModel(
colMArray
);
ds = new Ext.data.JsonStore({
baseParams:{json:Ext.encode(json)},
url:"syssjcx.action",
root:"allMessage",
width:gridWidth,
autoLoad:true,
fields: fileids
});
var grid = new Ext.grid.GridPanel({
el: 'message',
cm: cm,
ds: ds,
height:360
});
grid.render();
}
});
}
var cm,ds;
Ext.Ajax.request({
timeout:600000,
url:'syssjcxList.action',
params:{json:Ext.encode(json)},
failure: function(response,options){
return;
},
success: function(response,options){
var res = Ext.decode(response.responseText);
var heads = res.heads;
var fileids = res.fileids;
var colMArray = new Array();
var dsroot = new Array();
var divWidth = Ext.getDom("message").clientWidth;
var divHeight = Ext.getDom("message").clientHeight;
var gridWidth = divWidth*98/100;
var theWidth = gridWidth/(heads.length);
for(var i = 0;i<heads.length;i++){
colMArray[i] = {header:heads[i],width: theWidth,dataIndex:fileids[i]}
}
cm = new Ext.grid.ColumnModel(
colMArray
);
ds = new Ext.data.JsonStore({
baseParams:{json:Ext.encode(json)},
url:"syssjcx.action",
root:"allMessage",
width:gridWidth,
autoLoad:true,
fields: fileids
});
var grid = new Ext.grid.GridPanel({
el: 'message',
cm: cm,
ds: ds,
height:360
});
grid.render();
}
});
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货