And what are the ramifications of each?
I see that Model.save()
, for example, automatically refreshes the Model with results from the server. I'm not sure if sync()
does.
automatically refreshes the Model with results from the server
Store.sync()
refreshes modified records as well (provided you have setup the server response correctly).
So, technically, both methods do the same. However, in my opinion, you can use Model.save()
only in one case: when you don't have store
. Why? Because when you have store and nevertheless you use Model.save()
that's mean that you have setup connection (proxy) configuration for both store
and model
. And that's mean that you have duplicated code which is potentially harder to maintain.
So, to summarize, you use Model.save()
only if you use standalone model, without store (it may be the case when you have form
which is not connected to any grid. So you create standalone model for such form), and you use Store.sync()
in other cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With