1. #1
    Ext JS Premium Member jvandemerwe's Avatar
    Join Date
    Apr 2009
    Location
    Bad Salzuflen, Germany
    Posts
    46
    Answers
    2
    Vote Rating
    2
    jvandemerwe is on a distinguished road

      0  

    Default Answered: Some advise needed about setting ExtraParams in the store's proxy with Extjs 4.

    Answered: Some advise needed about setting ExtraParams in the store's proxy with Extjs 4.


    Hello,

    Just looking for a bit of advise here. Is the following way of setting the value of the post parameters for a store "load" method, the way to go? Or are there better ways to do it. I don't like it so much to set parameters directly, without calling a function, given by the framework. It would be nice to have something like "store.setExtraParams".

    Code:
    // set an additional parameter before loading, not nice but effective
            store.getProxy().extraParams.someparameter1 = newValue1;
            store.getProxy().extraParams.someparameter2 = newValue2;
            store.load({
                scope   : this,
                callback: function(records, operation, success) {
                    this.ProcessSomethingUseful(records, operation, success);
                }
            });
    Thanks in advance.

    Johan
    -->

  2. Hello Tobiu,

    Yes you're right by setting the parameters at store definition time. But I have some parameters that change, before the store is reloaded. I used to work in Ext 3 with the undocumented store.setBaseParams.

    In my example the store is reloaded after the search field is changing and I want to refresh my results on the new value. So, yes I want this parameter constantly walking along.

    And yes your "params" on the load also works in Ext 4. Just tested it and this does the job too.

    Thank you for your quick reply.

    Johan

  3. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,663
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      1  

    Default


    In Ext 3, you can set params in the load-call directly:

    Code:
    store.load({
        params : {...}
    })
    this should be possible in 4 too.

    you can also use the beforeLoad event to change params.

    the question is: do you want those params for ALL requests, then setting extraParams is fine. if it is just for this one call, i would go for the direct way.

    when adding more than one value to extraParams i would go for:

    Code:
    Ext.apply(store.getProxy().extraParams, {
        foo : 'bar',
        ...
    });
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine
    -->

  4. #3
    Ext JS Premium Member jvandemerwe's Avatar
    Join Date
    Apr 2009
    Location
    Bad Salzuflen, Germany
    Posts
    46
    Answers
    2
    Vote Rating
    2
    jvandemerwe is on a distinguished road

      0  

    Default Thank you

    Thank you


    Hello Tobiu,

    Yes you're right by setting the parameters at store definition time. But I have some parameters that change, before the store is reloaded. I used to work in Ext 3 with the undocumented store.setBaseParams.

    In my example the store is reloaded after the search field is changing and I want to refresh my results on the new value. So, yes I want this parameter constantly walking along.

    And yes your "params" on the load also works in Ext 4. Just tested it and this does the job too.

    Thank you for your quick reply.

    Johan
    -->

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar