0

Please check this fiddle and see how I have written code inside Ext.onReady function. While this code is working fine, If I need to write the same code inside a ExtJs view, How can I modify the existing code to include the grid and the group feature inside a view.

When I write code inside, Ext.onReady function, I can define a group the few line down, I can define a toolBar & then declare grid using Ext.create() and then include all these within the grid. But How can i achieve the same in a view???

Ext.define('MyView',
{
    extend: 'Ext.window.Window',
    alias: 'widget.myView',
    id: 'my-window',
    title: 'Test',

    width: 600,
    height: 400,
    minWidth: 600,
    minHeight: 400,

    modal: true,
    layout:
    {
        type: 'vbox',
        align: 'stretch'
    },
    items:
    [{
      xtype: grid // At this point, how can i declare group feature and include it??
    }]
});
BenMorel
  • 34,448
  • 50
  • 182
  • 322
SharpCoder
  • 18,279
  • 43
  • 153
  • 249
  • 3
    Look at how the `initComponent` method is used in the examples. – Evan Trimboli Nov 28 '13 at 13:12
  • Side note: don't define objects on the prototype, they will be shared among all instances. Also, when you define properties, on the prototype, the caller can still modify them through the configuration. If you don't want the caller to modify the `width,modal,layout` attributes, they should be defined in `initComponent`, that way they override anything passed in by the caller. Also, you should mark them with `@hide`, to signal that a property has been sealed and callers can't set it in the config – Ruan Mendes Dec 03 '13 at 17:36
  • @JuanMendes: Thank you for valuable comments. Can you please share an example and showcase it. – SharpCoder Dec 04 '13 at 13:33
  • @Brown_Dynamite Here's an old post that summarizes the concept of pre-configuring classes by extending `initComponent()` http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/ And here's a power point about the same concepts https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&ved=0CFwQFjAD&url=https%3A%2F%2Fwww.assembla.com%2Fspaces%2Fsachin_mittal%2Fdocuments%2FdxcXXKTQar36tmeJe5cbLA%2Fdownload%2FdxcXXKTQar36tmeJe5cbLA&ei=LKyfUpm-F4jpoAT__IGgAw&usg=AFQjCNEa6dbjZXuAUogG24bXZuzqVWhXuA&sig2=sImbF0EYkLlalQlaq2ViFg&bvm=bv.57155469,d.cGU – Ruan Mendes Dec 04 '13 at 22:31

0 Answers0