DigiDog
16 Apr 2012, 12:21 PM
Hi,
I've asked this question (http://stackoverflow.com/questions/10174703/extjs4-store-per-panel-instance)over on StackOverflow (see for discussion), but I think I'd like more feedback, I'm sure there's a proper way of doing this.
I want to be able to create multiple instances of data-bound tabs, that use the same controller and the same model for everything.
Should each have it's own store? I've only started, but I'm creating new tabs like this and not sure it's the right way (and how to proceed).
The same question from SO, without the confusion:
I have a tabpanel with multiple instances of the same component (let's call it product), each should call the server when it's opened, with an id parameter. Right now, in order to create these tabs - I use this in the Product controller Which creates a new instance of a view, but I feel like it's really incorrect.
createMainView: function (opts) {
return Ext.widget("productDisplay", opts);
}
I call it from my "main" controller, like this:
var tab = this.application.getController("Products")
.createMainView({ productId : id, closable: true })
tabs.add(tab);
tabs.setActiveTab(tab);
What's the correct way to properly use multiple instances of a view, each having an instance of one store and behavior (via the controller).
Can I use one named store for them (with a js file under app/store/product.js)?
Should I manually call load on the store from the controller (to pass the productId), or is there a nicer way?
Thank you!
I've asked this question (http://stackoverflow.com/questions/10174703/extjs4-store-per-panel-instance)over on StackOverflow (see for discussion), but I think I'd like more feedback, I'm sure there's a proper way of doing this.
I want to be able to create multiple instances of data-bound tabs, that use the same controller and the same model for everything.
Should each have it's own store? I've only started, but I'm creating new tabs like this and not sure it's the right way (and how to proceed).
The same question from SO, without the confusion:
I have a tabpanel with multiple instances of the same component (let's call it product), each should call the server when it's opened, with an id parameter. Right now, in order to create these tabs - I use this in the Product controller Which creates a new instance of a view, but I feel like it's really incorrect.
createMainView: function (opts) {
return Ext.widget("productDisplay", opts);
}
I call it from my "main" controller, like this:
var tab = this.application.getController("Products")
.createMainView({ productId : id, closable: true })
tabs.add(tab);
tabs.setActiveTab(tab);
What's the correct way to properly use multiple instances of a view, each having an instance of one store and behavior (via the controller).
Can I use one named store for them (with a js file under app/store/product.js)?
Should I manually call load on the store from the controller (to pass the productId), or is there a nicer way?
Thank you!