Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>1-I used following code to define a reusable grid, but when I make instance, no config in class definition either do not have effect of break the code. What is the reason?</p> </blockquote> <p>I can answer why your config doesn't have effect. Because <code>config</code> which is being passed into cunstructor <strong>is not</strong> your default config. You have to apply your default config in order to make default config to have effect: </p> <pre><code>constructor:function(config) { config = Ext.applyIf(config, this.config); this.callParent(arguments); this.initConfig(config); } </code></pre> <p>However, I don't know why <code>dockedItems:[/* items */]</code> breaks the code. Maybe you have syntax or logical errors somewhere within <code>/* items */</code>.</p> <blockquote> <p>2- How I can make some default columns in grid class and add some more columns to its objects?</p> </blockquote> <p>That is easy. Just override your initComponent function:</p> <pre><code>Ext.define("IBS.users.Grid", { extend: "Ext.grid.Panel", // ... initComponent : function(){ if (!this.columns) { // default columns: this.columns = [{ dataIndex: 'dkjgkjd', // ... }]; // if we passed extraColumns config if (this.extraColumns) for (var i=0; i &lt; this.extraColumns.length; i++) this.columns.push(this.extraColumns[i]); } this.callParent(arguments); }, // ... }); </code></pre> <blockquote> <p>3- Is there any restriction in class config declaration?</p> </blockquote> <p>I'm not aware of any. However, I wouldn't recommend to declare <strong>object</strong> configs in class definition. For example:</p> <pre><code>Ext.define("IBS.users.Grid", { extend: "Ext.grid.Panel", bbar: Ext.create('Ext.toolbar.Toolbar', // ... // ... }); </code></pre> <p>It will be ok with first instance of the class. But when you create the second instance it's bbar refers to the same object as the first instance. And therefore bbar will disappear from the first grid.<br> Instead declare object configs in <code>initComponent</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload