在.aspx文件中引用的一个方法: OpenWin("修改原因列表", ReportID.json.ReportId, 0,0);
这个方法是在JS文件ReportModify.js中定义的,该文件内容如下(flag参数为备用参数):
var storemodel = function() { storemodel.superclass.constructor.call(this) };
Ext.extend(storemodel, Ext.data.JsonStore, {
url: '/Projects/ReportManage/ReportModify/ReportModify.ashx?type=3',
root: 'data',
autoLoad: false,
totalProperty: 'total',
baseParams: { start: 0, limit: 20 },
fields:[{ name: 'ChangeNum', mapping: 'ChangeNum' },{ name: 'Remark', mapping: 'Remark' }]
});
function OpenWin(Text, value, flag, xz) {
var MyStore2 = new storemodel({});
if (modiwinPanel != null) {
modiwinPanel = null;
}
if (modiwinPanel == null) {
modiwinPanel = new Ext.Window({//
autowidth: true,
autoheight: true,
title: Text,
plain: true,
layout: 'fit',
closeAction: "hide",
items: [
new Ext.grid.GridPanel({
height: 160,
columns: [{ header: '修改次数', sortable: true, width: 210, dataIndex: 'ChangeNum' },
{ header: '修改原因', sortable: true, width: 210, dataIndex: 'Remark' }
],
store: MyStore2
})]
});
modiwinPanel.on('beforeclose', function() { modiwinPanel = null; });
MyStore2.load({ params: { start: 0, limit: 20, choise: xz, RID: value} });
modiwinPanel.show();
MyStore2 == null
}
}
结果在ReportModify.ashx有返回数据,但是没有成功加载到MyStore2中,后来将继承部分删掉,改为以下代码:
function OpenWin(Text, value, flag, xz) {
var MyStore2 = new Ext.data.JsonStore( {
url: '/Projects/ReportManage/ReportModify/ReportModify.ashx?type=3',
root: 'data',
autoLoad: false,
totalProperty: 'total',
baseParams: { start: 0, limit: 20 },
fields:[{ name: 'ChangeNum', mapping: 'ChangeNum' },{ name: 'Remark', mapping: 'Remark' }]
});
if (modiwinPanel != null) {
modiwinPanel = null;
}
if (modiwinPanel == null) {
modiwinPanel = new Ext.Window({//
autowidth: true,
autoheight: true,
title: Text,
plain: true,
layout: 'fit',
closeAction: "hide",
items: [
new Ext.grid.GridPanel({
height: 160,
columns: [{ header: '修改次数', sortable: true, width: 210, dataIndex: 'ChangeNum' },
{ header: '修改原因', sortable: true, width: 210, dataIndex: 'Remark' }
],
store: MyStore2
})]
});
modiwinPanel.on('beforeclose', function() { modiwinPanel = null; });
MyStore2.load({ params: { start: 0, limit: 20, choise: xz, RID: value} });
modiwinPanel.show();
MyStore2 == null
}
}
结果数据载入成功!请教诸位大虾,这是为什么?