Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extjs 4.1 When do I use a proxy on a store and when on a model?

Tags:

extjs

extjs4.1

There are two ways to use proxies in extjs 4.1 (server proxies in my case), one can tie it to a model or tie it on a store.

I am a bit confused about the usage: What is the difference between tieing a proxy to a store, and tieing it to a model?

What situations would one use one way or the other?

like image 627
mahatmanich Avatar asked Aug 15 '12 07:08

mahatmanich


1 Answers

OK I found it in the documentation of sencha App Architecture Part 2

Use proxies for models:

It is generally good practice to do this as it allows you to load and save instances of this model without needing a store. Also, when multiple stores use this same model, you don’t have to redefine your proxy on each one of them.

Use proxies for stores:

In Ext JS 4, multiple stores can use the same data model, even if the stores will load their data from different sources. In our example, the Station model will be used by the SearchResults and the Stations store, both loading the data from a different location. One returns search results, the other returns the user’s favorite stations. To achieve this, one of our stores will need to override the proxy defined on the model.

like image 127
mahatmanich Avatar answered Sep 22 '22 15:09

mahatmanich