1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    10
    Vote Rating
    0
    agruss is on a distinguished road

      0  

    Default passing parameters to store

    passing parameters to store


    Hello,

    this question has been asked in other Sencha forums before, but I cannot get it to work.

    I created a JsonP Store with autoload false, the url is a local file.

    I have not changed the default values of the parameters for "limitParam" and "startParam" (so it should be start and limit)

    When loading the data, I try to pass the additional parameters

    Code:
    var storeName = item.id+"Store";
    
    
    var store = Ext.getStore(storeName);
    layout.setActiveItem(panelName);
    
    
    store.load(
    {
        params: {
            start:0,
            limit:15
        }
    });
    console.log(store.data,{level: 'debug'});
    the panel with the grid opens correctly with the correct store, but the limit parameter is happily ignored.

    this is the request header sent to the json doc:

    http://localhost/architect/viewTest1/data/LCDs.json?_dc=1340897122767&page=1&start=0&limit=15

    and I still get back the complete file with all 30 entries and paging starts at 25, although the proxy is set to a pagesize of 15.

    Code:
    Ext.define('MyApp.store.productsStore', {
        extend: 'Ext.data.Store',
        requires: [
            'MyApp.model.productModel'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: false,
                storeId: 'LCDStore',
                model: 'MyApp.model.productModel',
                buffered: false,
                pageSize: 15,
                proxy: {
                    type: 'ajax',
                    url: 'data/LCDs.json',
                    reader: {
                        type: 'json'
                    }
                }
            }, cfg)]);
        }
    });
    Any ideas what I might be missing?

    thanks
    /anja

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,240
    Vote Rating
    121
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    From reading the above it looks like the library is doing its job. The framework will only the start and limit parameters, it is up to the server-side to read these parameters and do the paging.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 1

Tags for this Thread