Data back on a Store.save()

  1. #1

    Data back on a Store.save()

    I'm at least a week or so behind on the latest code, so this might have changed but: I can't see any way to get data that I assign to my AjaxResponse, in my handler, after the save event.

    So, I have a store and am calling .save with some params, and a callback. When the callback gets called, I'm not seeing any of my return data coming back. (AjaxResponse.data)

    I can trace and see it coming back through the proxy and down into recordsSaved, but I can't see where that data is being passed down to my callback anywhere. Looks like its being ignored as far as the callback is concerned.
  2. #2

    RE: Data back on a Store.save()

    Hi Dave,

    You are absolutely right. The last function where the data used is the recordSaved. Just I thought that this data will be used only save handler. If you need this data on the client side that can you tell me where you need it? May be in commitdone event handler or something else


  3. #3

    RE: Data back on a Store.save()

    Basically I just need a mechanism to get data back from my handler. Here's an example: If I have a store where I add a new record, say a new user, then when that user gets added by my handler I want to update another field on the page with the user's userId which is based off of an identity field in my database.

    So, I'd want my handler to report back "the user's id is 5" and then be able to get to that from my javascript.

    What I've done in the meantime is hacked the gridpanel js to have that dataobject tacked onto the options var, so that I can get access to it:

        recordsSaved : function(o, options, success) {
            options.result = o;
    So I can query options.result.data to get my value in my callback. Obviously this is a hack,and a better solution should be in place, but it works for now.

    Probably what would be the best is that the user can put an object into a "Response" property on the AjaxResponse. That would then get serialized in .MakeAnswer() and sent down as JSON to the recordsSaved function which could then drop it onto the options object, or create a new response object that can be passed to the callbacks.

    I could see where I'd want a save action to return a new set of records that I want to apply to another store too - so this method would work out fine. It basically combines a Save with a Load as one operation.

Similar Threads

  1. Replies: 12
    Last Post: Feb 20, 2012, 1:58 PM
  2. Going back to Page 1 when store data changes
    By omeszar in forum 1.x Help
    Replies: 2
    Last Post: Jul 29, 2011, 1:58 PM
  3. Replies: 3
    Last Post: Dec 01, 2010, 8:13 AM
  4. Help reading back data on a page
    By as2007 in forum 1.x Help
    Replies: 1
    Last Post: Feb 28, 2010, 4:50 AM
  5. Save Back to Store from textfields, etc.?
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Apr 30, 2009, 2:43 PM

Posting Permissions