zoukankan      html  css  js  c++  java
  • 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);
    });
  • 相关阅读:
    chrome视频播放加速
    centos磁盘空间重新分配
    mseed2sac的安装和使用
    查找台站信息得到台站数据的网站
    java install
    CMT learning
    hosts持续更新
    what is SVD and how to calculate it
    google 镜像
    z变换
  • 原文地址:https://www.cnblogs.com/foreverfendou/p/5239595.html
Copyright © 2011-2022 走看看