Oct 30, 2014, 6:32 AM
[CLOSED] Multiple Stores - design pattern required
Hi
I have a page that formulates quotes - its quite detailed and there is a lot of calculation done along with a lot of data being updated passed around from one grid to the next etc etc. The page itself uses grid and the bryntum gant control (in all 9 writable stores ) and nothing is persisted until the 'save' button is clicked ie (autosync is off).

In development its been ok and I have been getting this to save generally well but now that I am in testing, users have been having problems saving. The big issue is that its all in javascript and once an error is hit there is no coming back so I have some unhappy users. Because my users are all around the country it hasn't been easy tracking what is causing the mis-saves.
So to try and simplify things I am going to modify the save mechanism. Currently my save works like this:
- Each grid or control has its own javascript controller.
- When a user saves it starts at the top controller i.e. Estimate and that performs a save via a DirectMethod when the onsuccess fires I go to the next controller and perform any updates on the grid that are necessary i.e child records may need the EstimateId generated from the db. I go from each controller performing the save and then updating any child records before saving them.
I now want to change it so that I have one controller that collects all the data in one dataset and pass it all back to one DirectMethod. I will perform each object save and perform all the updates serverside.
This I think will keep it much cleaner plus I can implement some transaction/rollback scenario should something fail. Once I have done the save I now just need to get all the information back into the stores/grids with any new Id's issued by the db as well as foreign key Ids that need to be updated.
Any suggestions on how I do that? Can I pass data back somehow that will merge record information if it has changed? Much like when you add records back into e.ResponseRecords on BeforeChanged event of the store? (What is being called when records are written back to ResponseRecords?)
Or can you think of a more elegant way on which this could be done?
Thanks for any help
I have a page that formulates quotes - its quite detailed and there is a lot of calculation done along with a lot of data being updated passed around from one grid to the next etc etc. The page itself uses grid and the bryntum gant control (in all 9 writable stores ) and nothing is persisted until the 'save' button is clicked ie (autosync is off).
In development its been ok and I have been getting this to save generally well but now that I am in testing, users have been having problems saving. The big issue is that its all in javascript and once an error is hit there is no coming back so I have some unhappy users. Because my users are all around the country it hasn't been easy tracking what is causing the mis-saves.
So to try and simplify things I am going to modify the save mechanism. Currently my save works like this:
- Each grid or control has its own javascript controller.
- When a user saves it starts at the top controller i.e. Estimate and that performs a save via a DirectMethod when the onsuccess fires I go to the next controller and perform any updates on the grid that are necessary i.e child records may need the EstimateId generated from the db. I go from each controller performing the save and then updating any child records before saving them.
I now want to change it so that I have one controller that collects all the data in one dataset and pass it all back to one DirectMethod. I will perform each object save and perform all the updates serverside.
This I think will keep it much cleaner plus I can implement some transaction/rollback scenario should something fail. Once I have done the save I now just need to get all the information back into the stores/grids with any new Id's issued by the db as well as foreign key Ids that need to be updated.
Any suggestions on how I do that? Can I pass data back somehow that will merge record information if it has changed? Much like when you add records back into e.ResponseRecords on BeforeChanged event of the store? (What is being called when records are written back to ResponseRecords?)
Or can you think of a more elegant way on which this could be done?
Thanks for any help
Last edited by Daniil; Nov 07, 2014 at 11:42 AM.
Reason: [CLOSED]