davs
davs

Reputation: 9406

extjs' passing extra parameters for grid due using pagination buttons

I have a problem. I have getAllJobsControllerUrl() function which return url with specific parameters:

        proxy: new Ext.data.ScriptTagProxy({
                      url: getAllJobsControllerUrl(),
                      method : 'GET'
        })

And all code concerned with grid:

   var store = new Ext.data.JsonStore({
        root: 'jobs',
        totalProperty: 'totalCount',
        fields: [ 

                  {firld description}],

        proxy: new Ext.data.ScriptTagProxy({
                      url: getAllJobsControllerUrl(),
                      method : 'GET'
        })
    });


    var grid = new Ext.grid.GridPanel({
        id: 'mainGrid',
        el:'mainPageGrid',
        autoWidth: true,
        store:store,
        cm:cm,
        viewConfig:{
            forceFit:true
        },
        width :1000,
        height:500,
        loadMask:true,
        frame:false,

        bbar: new Ext.PagingToolbar({
            id : 'mainGridPaginator',
            store:store,
            pageSize:10,
            displayMsg: '{0} - {1} of {2} results',
            emptyMsg:'No results found for your search criterion',
            displayInfo:true
        }),

        tbar:tabBar
    });

The Question/Problem: When I make Ajax Request with getAllJobsControllerUrl() and then reload store, I'm sending to server proper request string.

But when I'm trying to use pagination buttons ('<-' and '->' in the bottom of grid), It seems I'm sending the request string which has been formed once on first access and then it don't modify.

F1 :)

Added:

function getAllJobsControllerUrl() {
    return '../../statusList/getJobs/search-' + searchType + '-' + searchValue + 
            '/sort-' + sortName + '-' + sortOrder + 
            '/filterSd-' + filterSubmittedDate +
            '/filterSt-' + filterStatus +
            '/filterUn-' + filterUserName +
            '/filterJn-' + filterJobName
}

Upvotes: 3

Views: 10302

Answers (2)

davs
davs

Reputation: 9406

Thanks everybody for trying help me. I have migrated my code to extjs 4.0 and decided to make extra parameters, which are now working for me

            store : store = new Ext.data.JsonStore({
                fields : [....],
                ....
                listeners: {
                    'beforeload': function(store, options) {
                        store.proxy.extraParams.param1='val1';
                        store.proxy.extraParams.param2='val2';
                    },

So, in result I'm getting follow request:

http://myip:8080/myproject/statusList/getJobs?param1=val1&param2=val2

Good luck!

Upvotes: 3

Amol Katdare
Amol Katdare

Reputation: 6760

You need to update the proxy with new url before load. Best way would be to use the store's beforeload event.

Change your store definition to


var store = new Ext.data.JsonStore({
    root: 'jobs',
    totalProperty: 'totalCount',
    fields: [ 

          {firld description}],

proxy: new Ext.data.ScriptTagProxy({
              url: getAllJobsControllerUrl(),
              method : 'GET'
}),

listeners:{
    beforeload:function(store, options){
        store.proxy.setUrl(getAllJobsControllerUrl());
    }
}

});

Upvotes: 0

Related Questions