1. #11
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Vote Rating
    0
    insomnix is on a distinguished road

      0  

    Default


    I placed that piece of code inside my onJsonstoreBeforeLoad event in the store. If you look at my first post, I replaced:
    Code:
            Ext.apply(store.getProxy().extraParams, {
                name: 'test'
            });
    with:
    Code:
    store.getProxy().setExtraParam('name', 'test');

  2. #12
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    Quote Originally Posted by insomnix View Post
    I placed that piece of code inside my onJsonstoreBeforeLoad event in the store. If you look at my first post, I replaced:
    Code:
            Ext.apply(store.getProxy().extraParams, {
                name: 'test'
            });
    with:
    Code:
    store.getProxy().setExtraParam('name', 'test');

    Code:
    setExtraParam
    can be used if you only have to add one extra param.

    Code:
            Ext.apply(store.getProxy().extraParams, {
                name: 'test'
            });
    Why don't you:
    Code:
    store.getProxy().setExtraParams({name:'test'});
    store.load();
    ?

  3. #13
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Vote Rating
    0
    insomnix is on a distinguished road

      0  

    Default


    I had problems getting this to work correctly outside the store:
    Code:
    store.getProxy().setExtraParams({name:'test'}); 
    store.load();
    It just wouldn't load the extra parameters to the store. Granted I may have been calling it from the wrong location, or something, but doing a call on the before load event within the store I was able to pass the extra params. Of course within the on load event, you wouldn't want to call the store.load event again unless you want to be stuck within an infinite loop.

    I have used ExtJs on websites and I have some understanding of how it works, but I have had some serious problems trying to figure out how Architect works. I think these products are really good for online applications, but they need some serious improvements in their documentation and tutorials. Especially since most of the tutorials I find to try and figure this stuff out are for older versions that are no longer applicable.

  4. #14
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    When should you add the params? Is it because they are dynamic so you would like to add them at the start or?
    Because you can add them directly in the Architect if they are static. If not you can grab the store and add them as said before, are doing that all the time in my applications.

  5. #15
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Vote Rating
    0
    insomnix is on a distinguished road

      0  

    Default


    What I want to do is update a list of items based on current location. If you have a sample of code where you were able to adjust store params succesfully in your app, then I would love to see it. Most of the time I get small snippets, one or two lines, that don't help me a whole lot because they are out of context. I found a nice twitter tutorial when I started and tried to duplicate, but it was using an older version and I had some trouble modifing it to work in architect.

  6. #16
    Sencha Premium Member
    Join Date
    Nov 2007
    Posts
    79
    Vote Rating
    4
    oldroy is on a distinguished road

      0  

    Default onStoreBeforeLoad

    onStoreBeforeLoad


    Hello,
    I think they are talking of an event binding on the store itself.

    Click your store in the project inspector.
    Go to Event Bindings in the config panel below.
    Click the + button to add an event.
    Use the Event type chooser box to choose beforeload.
    This will give you a function skeleton with the store as a parameter to the function.

    Add in this:
    store.getProxy().setExtraParam('my_param_name', value);
    The params you want to set this way need to be available before the store loads.

  7. #17
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    New Zealand
    Posts
    115
    Vote Rating
    24
    wayne.rudd will become famous soon enough wayne.rudd will become famous soon enough

      0  

    Default


    Also, if your are using ExtDirect you need to add the param names to paramOrder

    e.g.

    Code:
    orgid=item.orgid;
    var bookings = Ext.data.StoreManager.lookup('Bookings');
    bookings.proxy.paramOrder=['start','limit','orgid','startdate'];
    bookings.proxy.extraParams={orgid:orgid,startdate: '2012/01/20'};

  8. #18
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    Quote Originally Posted by insomnix View Post
    What I want to do is update a list of items based on current location. If you have a sample of code where you were able to adjust store params succesfully in your app, then I would love to see it. Most of the time I get small snippets, one or two lines, that don't help me a whole lot because they are out of context. I found a nice twitter tutorial when I started and tried to duplicate, but it was using an older version and I had some trouble modifing it to work in architect.
    Mini project where it loads the store when pressing load button. It could be any other event. The store is connected to a list but it could be something else.

    Note. I have not tested it because I don't have the correct URL for the proxy and the Model has no fields
    I hope it helps.
    Attached Files

  9. #19
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

  10. #20
    Sencha User
    Join Date
    Apr 2012
    Posts
    22
    Vote Rating
    0
    insomnix is on a distinguished road

      0  

    Default


    thnx.