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);
    });
  • 相关阅读:
    Tensorflow2.0基础
    Tensorflow2.0多层感知机实现mnist手写数字识别
    numpy数组的维度操作和axis的对应关系
    jupyter notebook使用
    darknet批量测试并保存图片
    darknet训练自身数据集的小问题
    PIL批量更改图片格式 及bat/cmd文件批量修改文件后缀名
    cv::Mat用法
    VS配置opencv、cuda及调用yolo动态链接库
    VS之 32 or 64
  • 原文地址:https://www.cnblogs.com/foreverfendou/p/5239595.html
Copyright © 2011-2022 走看看