-1

Can anybody tell How to call view from controller of the app in extjs4.1

Thanks

mohan
  • 13,035
  • 29
  • 108
  • 178
  • refer [this](http://stackoverflow.com/questions/5890272/extjs-4-mvc-loading-a-view-from-controller) – MMT Sep 18 '13 at 09:28
  • Are you serious? There are tons of examples and documentation on Sencha's website. – dbrin Sep 19 '13 at 06:51

1 Answers1

0

You can either use component query or refs.

Component query will find the view by itemid, id, xtype, or the heirarchy of containers that it is in. See it's documentation here. It works pretty simply for example, searching by id goes like this: Ext.ComponentQuery.query('#myPanelId')

Alternatively, you could use refs. They use the same query language as the component query but are defined on the controller so you can name and reuse them using an auto generated method like this.getMyView() to get the view. Check the documentation here and read the intro documentation for the controllers and you will get the idea.

Ext.define("MyApp.controller.Foo", {
    extend: "Ext.app.Controller",
    refs: [
        {
            ref: 'list',
            selector: 'grid'
        }
    ],
    myMethod: function () {
        //This is how you access your named ref!!!
        this.getList().getStore().sort();
    }
});
Stephen Tremaine
  • 934
  • 6
  • 15