• Extjs 4.2 grid 分页问题,点击下一页参数没带过去


    最初的store写法:

    var store = Ext.create('Ext.data.Store', {
        model: 'PKU',//这个地方CarPKU不是一个对象,而是一个类
        remoteSort: false,
        remoteFilter: true,
        pageSize: limitCarPKU,  //页容量20条数据
        method: 'POST',
        proxy: {//代理
            type: 'ajax',
            url: '/Handler/PKUCarHandler.ashx?Func=PKUCarUnites',
            extraParams: {
                TrademarkId: Ext.getCmp('TrademarkId').getValue(),
                SubTrademarkId: Ext.getCmp('SubTrademarkId').getValue(),
                SeriesId: Ext.getCmp('SeriesId').getValue(),
                ModelNumberId: Ext.getCmp('ModelNumberId').getValue(),
                start: startCarPKU,
                limit: limitCarPKU
            },
            reader: {
                type: 'json',
                root: 'data',  //根节点
                totalProperty: 'result' //数据总条数
            }
        },
        sorters: [{
            //排序字段。
            property: 'CarPKU',
            //排序类型,默认为 ASC 
            direction: 'ASC'
        }],
        //autoLoad: true  //即时加载数据
    });

    问题出在:extraParams 在4.2中没作用

     extraParams: {
                TrademarkId: Ext.getCmp('TrademarkId').getValue(),
                SubTrademarkId: Ext.getCmp('SubTrademarkId').getValue(),
                SeriesId: Ext.getCmp('SeriesId').getValue(),
                ModelNumberId: Ext.getCmp('ModelNumberId').getValue(),
                start: startCarPKU,
                limit: limitCarPKU
            },

    解决方法:

    1.将extraParams进行删除

    2.新增代码:

    store.on('beforeload', function (store, options) {
        var params = {
            TrademarkId: Ext.getCmp('TrademarkId').getValue(),
            SubTrademarkId: Ext.getCmp('SubTrademarkId').getValue(),
            SeriesId: Ext.getCmp('SeriesId').getValue(),
            ModelNumberId: Ext.getCmp('ModelNumberId').getValue(),
            start: startCarPKU,
            limit: limitCarPKU
        };
        Ext.apply(store.proxy.extraParams, params);
    });
    具体如下:
    var store = Ext.create('Ext.data.Store', {
        model: 'PKU',//这个地方CarPKU不是一个对象,而是一个类
        remoteSort: false,
        remoteFilter: true,
        pageSize: limitCarPKU,  //页容量20条数据
        method: 'POST',
        proxy: {//代理
            type: 'ajax',
            url: '/Handler/PKUCarHandler.ashx?Func=PKUCarUnites',
            reader: {
                type: 'json',
                root: 'data',  //根节点
                totalProperty: 'result' //数据总条数
            }
        },
        sorters: [{
            //排序字段。
            property: 'CarPKU',
            //排序类型,默认为 ASC 
            direction: 'ASC'
        }],
        //autoLoad: true  //即时加载数据
    });
    
    store.on('beforeload', function (store, options) {
        var params = {
            TrademarkId: Ext.getCmp('TrademarkId').getValue(),
            SubTrademarkId: Ext.getCmp('SubTrademarkId').getValue(),
            SeriesId: Ext.getCmp('SeriesId').getValue(),
            ModelNumberId: Ext.getCmp('ModelNumberId').getValue(),
            start: startCarPKU,
            limit: limitCarPKU
        };
        Ext.apply(store.proxy.extraParams, params);
    });
  • 相关阅读:
    C语言II博客作业03
    C语言II博客作业02
    C语言II博客作业01
    学期总结
    C语言I博客作业08
    C语言I博客作业07
    C语言I博客作业06
    C语言|博客作业05
    C语言I博客作业04
    【lhyaaa】2020深圳大湾区比赛总结
  • 原文地址:https://www.cnblogs.com/foreverfendou/p/5239595.html
Copyright © 2020-2023  润新知