首页 新闻 会员 周边 捐助

新手请教ASP.NET+EXT关于JsonStore的问题

0
悬赏园豆:10 [待解决问题]

    在.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
    }
}

结果数据载入成功!请教诸位大虾,这是为什么?

血唱魂的主页 血唱魂 | 初学一级 | 园豆:192
提问于:2012-05-14 17:34
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册