1. #1
    Ext JS Premium Member
    Join Date
    Jun 2008
    Posts
    69
    Vote Rating
    0
    Brendan is on a distinguished road

      0  

    Default change store URL or passing parameters

    change store URL or passing parameters


    Hi all,

    I have a few stores e.g.
    round_ladder_store = new Ext.data.Store({ url: 'feeds/ladder.php',.....

    I need to update the URL at times to have: ladder.php?something=1&somthing=2

    Whats the best way to do this? can I use parameters in the store or just change the URL?

    I've seen examples like the one below, is this useful or should I somehoe just change the URL prior to doing a reload?

    round_ladder_store.reload( { params: {
    race_date: page_state.race_date,
    pool_code: page_state.pool_code......

    -thanks for your help in advance.

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    6
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    It is possible to change the url, however I'd go the route of changing params. Don't forget you can also you baseParams if you have info you want to send with all XHRs. Should you choose to change the url see the Grid FAQ on how to do it.

  3. #3
    Ext JS Premium Member
    Join Date
    Jun 2008
    Posts
    69
    Vote Rating
    0
    Brendan is on a distinguished road

      0  

    Default


    I'm not having much luck here at all:

    I have tried changing the store:

    round_market_store = new Ext.data.Store({ url: 'feeds/market.php',
    baseParams: {marketid: '1', count: '30'},
    method: 'GET',
    reader: new Ext.data.XmlReader({record: 'Item', id: 'id', totalRecords: '@total' }, [
    {name: 'runner', mapping: 'ItemAttributes > runner'}, 'back', 'lay', 'graph'])
    });

    changing the load....

    round_market_store.load({ params: {
    marketid: '20184780',
    count: '30'}
    });

    but firebug is still showing that nothing was passed?

    Am I missing somthing here?

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    112
    Vote Rating
    0
    BernieM is on a distinguished road

      0  

    Default


    Don't specify the same baseParams that you are specifying in your load params. baseParams are parameters that will be passed with the same value on every request. The params you specify in your load are params whose values are expected to change every time you do a load().

    One other (harmless) error is that Ext.data.Store doesn't have a method property in its config. I presume that this is because it always needs to POST parameters so there is no sense in doing anything else.

    Is Firebug acknowledging that an AJAX request was made or are you failing before that can even happen? If you are failing prior to request time what is the error console telling you?

  5. #5
    Ext JS Premium Member
    Join Date
    Jun 2008
    Posts
    69
    Vote Rating
    0
    Brendan is on a distinguished road

      0  

    Default


    I've tried everything.... trying parms on store only, on load, both, but nothing....

    I'm not getting any errors, but I can see from firebug the call had no parameters attached.

    atm:

    round_market_store = new Ext.data.Store({ url: 'feeds/market.php',
    reader: new Ext.data.XmlReader({record: 'Item', id: 'id', totalRecords: '@total' }, [
    {name: 'runner', mapping: 'ItemAttributes > runner'}, 'back', 'lay', 'graph'])
    });

    and:

    round_market_store.load({ params: {
    marketid: page_state.marketid,
    count: page_state.graph_points}
    });

    it just refuses to add the 2 parameters to the end of the URL with .load or .reload

    Interestingly it is placing a ? after the script, so it "knows" something should go there... e.g.

    feeds/market.php?

    -thanks.

Thread Participants: 2