Reputation: 382
I'm new to ExtJs and I am trying to get a sense of what are the best practices.
I noticed that if I want to access a store in the controller, I should use the method: getMyStoreNameStore()
But what if I have two stores of the same type (for example, they are both "myStore"). How would I distinguish one from the other? The getter method the constructor provides seems like it would not be account for this.
A similar question could be said for views. I know you are suppose to use refs
and designate a selector
, but what if I have two instances of a class in the same view (e.g. my viewport). How do I designate one of them? Or is that what the purpose of query
is?
Upvotes: 0
Views: 246
Reputation: 15673
Unless you are creating instances of windows you probably don't want to be creating multiple instances. For both stores and views you can store a reference to the instances of your objects in the controller if necessary. Or you can add an arbitrary property to them and search by that.
Be very careful with sharing the store between components. Sometimes that exactly what you want and other times you don't (like combo-boxes). When you don't want to share the stores make sure to explicitly create new instance (with new
keyword or create
function)
Upvotes: 1