I have build a simple MVC application where I have a form and I need to load data into it.
I’m wondering if I should load this data using a store or directly using the model class. I have already a store for my grid.
So I see this 3 option.
- Load data using Model class
- Load data using the existing store (a grid uses this store already)
- Create a second store and load my data using it.
If your store uses the same model and the data (record) you edit will defiantly be loaded in that store (for example if you open the form on a double-click of a gridrow) or can be inserted into it I recommend you to go with the store approach.
If you edit a record (model-instance) that will not necessarily loaded into the grid-store the you should load the data using the model.
A second store will only be necessary if both points above are true and you also wan’t to batch multiple record (model-instance) edits from that form into one request to the server.
A third option is to bind the form directly to the server, but I recommend you to use the model-approach.