[Q] fail-safe add to ItemFileStore

View: New views
1 Messages — Rating Filter:   Alert me  

[Q] fail-safe add to ItemFileStore

by V S P :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wanted to ask for advice on the following

Have data grid, with ItemFileWrite store

when a new item is 'Added' to the ItemFileStore

I would like to be able to execute an Ajax call to insert that item into
the
database and only when that call returns, I would like to 'commit' it to
the item file store,
otherwise, if the db update was not successful -- I would like to
rollback.



I have the following potential solutions, but would like to know if they
are 'recommended'

a) inherit from item file store, add 2 new methods
   startSavingItem
   finishSavingItem

   first call startSaving, have starSaving execute dojo.RPC call to the
   server, and specify
   'finishSaving' as deffered method to be called on return of the ajax
   call

   Finish saving then gets called, and it executes 'newItem' on the
   store.



b)  First save in the database, then add to the item file store



however, for some reason I am thinking that the stores provide better
'built-in' management
with callbacks, but I cannot figure out exactly what examples to look
for on this
(I use in other places in program dojox.data.ServiceStore  but this is
for 'read only' stores)


thank you in advance,
Vlad



--
Vlad P
author of C++  ORM  http://github.com/vladp/CppOrm/tree/master


--
http://www.fastmail.fm - Accessible with your email software
                          or over the web

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest