Search code examples
extjsextjs4paging

Custom Paging parameters in Extjs4


In Ext 4, whenever you call

store.loadPage(1)

Ext seems to set the paging parameters start and limit in the request for me.

However I need page and pageSize as the keys for my request parameters. This is how the server handles paging and I have little control over it.

Is there a way I can use such custom paging parameters instead of the default ones provided by Ext?


Solution

  • As Evan answered, but with a concrete example:

    Ext.define('MyApp.store.Requests', {
        extend:'Ext.data.Store',
        model:'MyApp.model.Request',
        autoLoad:false,
        remoteSort:true,
        proxy:{
            type:'ajax',
            url:'request/list.json',
            //override default param names
            startParam:"offset",
            limitParam:"max",
            sortParam:"sort",
            simpleSortMode:true, //required for directionParam to be used
            directionParam:"order",
            reader:{
                type:'json',
                root:'data'
            }
    
        },
        pageSize:25
    });