View Full Version : [ExtJS 4.0]MVC,how can i fetch store in the controller?

8 Dec 2011, 7:15 AM
I am using ext-4.0, and I have used the suggested ext4 mvc architecture. During dev ,
Ext.define('Site.template.controller.TemplateController', {
extend : 'Ext.app.Controller',
stores : ['Site.template.store.TemplateStore',
models : ['Site.template.model.TemplateModel'],
views : ['Site.template.view.TemplateCreate',
init : function() {
'#saveTemplateAction' : {
click : this.saveTemplateAction
saveTemplateAction : function(button) {
var win = button.up('window');
var form = win.down('form');
var values = form.getValues();
if (form.getForm().isValid()) {
success : function(form, action) {
// server success

i want refresh the view which name is :'Site.template.view.TemplateList',
but i don't know how to fetch the view? Can you help me ? Thanks a lot !

failure : function(form, action) {
// server failed
} else {
// if form is not valid.

8 Dec 2011, 1:11 PM
The easiest way is with a query (either using the general Ext.ComponentQuery.query()) or maybe you can use a combination of up() and/or down() calls on one of the components you already declared in that function (but I can't guarantee that because I can't see your view code).

Or if you want to use that component in more places in that controller you can create a ref on the controller and a getter will be generated for you.