开发者

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.S开发者_运维百科criptTagProxy({
                      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
}


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!


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());
    }
}

});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜