1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    138
    Vote Rating
    0
    nar is on a distinguished road

      0  

    Default paging grid params

    paging grid params


    One of my grids is loaded by sending several filter options that modify a db query, without these params the query cannot be constructed. In adding paging I have found that while I load the grid with the needed params the first time it does not send the orginal params for each page click. Is there a better way to do this than attaching a listener to a beforeload event and moding baseparams each time?

    My initial store load:
    Code:
    store.load({params: {filter: filter, data: data, start:0, limit:25}});

  2. #2
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    698
    Vote Rating
    28
    carol.ext has a spectacular aura about carol.ext has a spectacular aura about

      0  

    Default


    [Edit] Oops, I see the end of your post mentions baseParams, why do you need to modify each time ?


    Look at baseParams and setBaseParam in Store API.

    Also, the Grid FAQ can help with these and many other questions.

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    138
    Vote Rating
    0
    nar is on a distinguished road

      0  

    Default


    I know I could use setbaseparams on a click of the paging toolbar, im wondering if there is a better builtin way to use the params that were sent in the store in the last request.

  4. #4
    Sencha User
    Join Date
    Nov 2008
    Posts
    138
    Vote Rating
    0
    nar is on a distinguished road

      0  

    Default


    My server is expecting filter and data each time along with start and limit, filter and data are not static they change based on the view. So I load my grid during the initial load with filter, data, start and limit, now someone clicks a page button and filter and data are not included in the next request sent. It seems like there should be some built in method of using the same params that were sent the time before without having to create a listener and set and modify base params on every click.

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      1  

    Default


    You could also do this:
    Code:
    Ext.override(Ext.PagingToolbar, {
        doLoad : function(start){
            var o = {}, pn = this.getParams();
            o[pn.start] = start;
            o[pn.limit] = this.pageSize;
            if(this.fireEvent('beforechange', this, o) !== false){
                var options = Ext.apply({}, this.store.lastOptions);
                options.params = Ext.applyIf(o, options.params);
                this.store.load(options);
            }
        }
    });
    to make the paging toolbar reuse all load options except start and limit parameters.

  6. #6
    Sencha User
    Join Date
    Nov 2008
    Posts
    138
    Vote Rating
    0
    nar is on a distinguished road

      0  

    Default


    Perfect Condor, would be great to see that built in =0

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Made a feature request for it.

  8. #8
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    698
    Vote Rating
    28
    carol.ext has a spectacular aura about carol.ext has a spectacular aura about

      0  

    Default


    Are you using remote sorting? Wouldn't that have an issue with params too?

  9. #9
    Ext User
    Join Date
    Jul 2009
    Posts
    2
    Vote Rating
    1
    W3Design is on a distinguished road

      0  

    Default


    Thanx a lot Condor this works perfectly. Really hope they include it

    Been struggling for hours trying to get the paging working with my filtering

  10. #10
    Sencha Premium Member
    Join Date
    Oct 2009
    Posts
    19
    Vote Rating
    0
    pym is on a distinguished road

      0  

    Default


    Thanks that works perfectly.