I am trying to create Panel
class object with different items. Basically its related with Desktop app in ExtJS.
DetailView.js
Ext.define("App.view.DetailView", {
extend : 'Ext.panel.Panel',
alias : 'widget.asset-panel',
itemId : 'Detail-view',
region : 'center',
initComponent : function() {
this.items = [ comboboxes, customPanel ];
this.callParent(arguments);
}
});
I am trying to create items
component in both the way i.e. using xtype
and using Ext.create()
way. I am not sure which is correct and how should I got about it.. below is comboboxes
variable inside DetailView.js
var comboboxes = {
xtype : 'form',
border : false,
padding : '5 5 5 5',
items : [ {
layout : 'column',
border : false,
width : 600,
items : [ {
xtype : 'combobox',
columnWidth : .15,
itemId : 'filter-1',
store : [ 'Employee', 'Manager', 'TeamLead' ]
}, {
xtype : 'combobox',
columnWidth : .15,
margin : '0, 0, 0, 15',
store : [ 'Keywords', 'Names' ]
}, {
xtype : 'combobox',
columnWidth : .15,
margin : '0, 0, 0, 15',
store : [ 'Some Data here' ]
}]
} ]
};
So far so good, If I am keeping this.items = [comboboxes]
in DetailView
class its working fine without any issue. but when I am trying to add other component, such as customPanel inside DetailView.js
var custom = Ext.create('Ext.panel.Panel', {
itemId : 'panel_1',
height : 300,
border : false,
layout : 'card',
items : [ {
xtype : 'container',
itemId : 'listCt',
layout : {
type : 'vbox',
align : 'stretch'
},
defaults : {
margin : 2
},
items : []
}, {
xtype : 'container',
itemId : 'fitCt',
layout : 'fit'
} ]
});
I tried both the way to initialize panel, as in above and by using initComponent()
but every time it gives error:
Uncaught TypeError: Cannot set property 'component' of null ext-all.js:22
Ext.cmd.derive.privates.finishRender ext-all.js:22
Ext.cmd.derive.finishRenderItems ext-all.js:22
Ext.cmd.derive.finishRender ext-all.js:22
Ext.cmd.derive.privates.finishRenderChildren ext-all.js:22
Ext.cmd.derive.afterRender ext-all.js:22
Ext.cmd.derive.privates.finishRender ext-all.js:22
Ext.cmd.derive.finishRenderItems ext-all.js:22
Ext.cmd.derive.finishRender ext-all.js:22
Ext.cmd.derive.privates.finishRenderChildren ext-all.js:22
Ext.cmd.derive.afterRender ext-all.js:22
Ext.cmd.derive.privates.finishRender ext-all.js:22
Ext.cmd.derive.finishRenderItems ext-all.js:22
Ext.cmd.derive.finishRender ext-all.js:22
Ext.cmd.derive.privates.finishRenderChildren ext-all.js:22
Ext.cmd.derive.afterRender ext-all.js:22
Ext.cmd.derive.afterRender ext-all.js:22
Ext.cmd.derive.privates.finishRender ext-all.js:22
Ext.cmd.derive.render ext-all.js:22
Ext.cmd.derive.privates.doAutoRender ext-all.js:22
Ext.cmd.derive.show ext-all.js:22
Ext.define.restoreWindow Desktop.js?_dc=1406637300888:388
Ext.define.onShortcutItemClick Desktop.js?_dc=1406637300888:199
fire ext-all.js:22
doFireEvent ext-all.js:22
a.doFireEvent ext-all.js:22
fireEventArgs ext-all.js:22
fireEvent ext-all.js:22
Ext.cmd.derive.processUIEvent ext-all.js:22
Ext.cmd.derive.handleEvent ext-all.js:22
Ext.cmd.derive.doFire ext-all.js:22
Ext.cmd.derive.fire ext-all.js:22
Ext.cmd.derive.doDispatchEvent ext-all.js:22
Ext.cmd.derive.dispatch ext-all.js:22
Ext.cmd.derive.dispatch ext-all.js:22
Ext.cmd.derive.doPublish ext-all.js:22
Ext.cmd.derive.publish ext-all.js:22
Ext.cmd.derive.onDelegatedEvent ext-all.js:22
(anonymous function)
it gives error when reinitialing window. i.e. it work only in first execution, but not in second. I doubt if components are being render and destroyed properly. What could be the possible reason ? any possible solution ?