Results 1 to 7 of 7

Thread: Problem Sending Extra Parameters using PagingToolbar buttons (Ext JS 4)

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    20

    Question Problem Sending Extra Parameters using PagingToolbar buttons (Ext JS 4)

    Hello,
    I am using a gridpanel with a paging toolbar contained within the panel's bbar.
    When reloading data to store, it is required that parameters are passed to the server,
    in order to filter source column data. The store has autoload set to false.


    When loading is invoked, e.g. by clicking an item in a tree panel, it is possible
    to set the extra parameters in the store command, e.g. as shown below:


    store.load({
    params: {
    // specify params for the first page load if using paging
    start: 0,
    limit: myPageSize,
    // other params
    foo: 'bar'
    }
    });


    However when clicking on the paging buttons, I do not know how to pass the extra
    parameters?
    Please could you advise?


    kind regards,
    Simon

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    If you need parameters to persist, you need to add the params to the extraParams object on the proxy.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    20

    Question require dynamic parameters to be sent

    Thank you Mitchell for reply.


    I should have said also that:
    I require that the parameters sent to the server following clicking on the paging buttons must be dynamic, i.e. shall change each time - would you know how this can be done? can/how the extraParams be changed?

    kind regards,
    Simon

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    20

    Default

    Hello, I should have said also that:
    I require that the parameters sent to the server following clicking on the paging buttons must be dynamic, i.e. shall change each time - would you know how this can be done? can/how the extraParams be changed?
    kind regards,
    Simon

  5. #5
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    Use a beforeload listener on the store.

    The filters demo uses this technique:

    http://dev.sencha.com/deploy/ext-4.0...ter-local.html

    Have a search through FiltersFeature.js for beforeload:

    http://dev.sencha.com/deploy/ext-4.0...tersFeature.js

  6. #6
    Sencha User
    Join Date
    Nov 2011
    Posts
    20

    Question "beforeLoad"fails to send extra parameters following paging buttons being selected.

    Thank you for your reply.

    I have used a beforeLoad listener as below.
    The parameters are correctly sent to the server the first time the grid's store is loaded. However,
    when I select the paging buttons, the beforeLoad function is called but the parameters are
    not sent. Would you know why this might be?

    Code:
    beforeLoad : function (store, options) {
        var params = ["football","cricket"];
        Ext.apply(options.params, params);
     }
    kind regards,
    Simon

  7. #7
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    It should work fine.

    The example you've posted is a bit odd. Using Ext.apply with an array?

    I suggest adding some console logging for options.params at the end of your beforeLoad handler, check whether it's correct at that point. If it subsequently fails to send the expected request I'd advise stepping through with a debugger, though I can't currently see any way this could happen.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •