-- ajgarlag <[email protected]> wrote (on Friday, 25 September 2009, 01:56 AM -0700): > Hi folks, I've just subscribed the mailing lists. > Matthew Weier O'Phinney-3 wrote: > > The place that problems occur is when I add new rows -- Dojo generates a > > unique hash for the ID, but that means that if I save() a second time, > > JsonRestStore tries to do a PUT (update) request -- and I have an > > invalid identifier. I'm still trying to work out that part of the > > equation. > > Matthew, I had a similar problem last week working with a dijit.Tree widget > and a JsonRestStore at the client side (with dojo 1.3.2), and a > Zend_Rest_Controller at the server side. The key to solve it is that when > you create a new item, the model should make a POST request to create it at > the server. This post request sends an additional header with de Content-Id > that dojo has assigned to the new created item. > > When the item it's created at the server side, that content-id it's stored > at a temporary array as the key, and the real id for that item as the value. > Then, when a PUT request is received to update an item with an ID that match > this pattern /^[\da-f]{...@\w*$/, the action looks at the temporary array, > and find the real ID of the item which should be updated. > > You can find some info at > http://www.sitepen.com/blog/2009/01/26/new-in-jsonreststore-13-dates-deleting-conflict-handling-and-more/ > (Section: In Transaction Referencing)
Awesome - I'll look into that some more. Thanks for the information! -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/
