PDA

View Full Version : Custom controls, panel dynamic loading tree



jakey525
19 Nov 2012, 3:55 AM
hi all


I define two controls, and then in a control render another control


code:


my app.js:
Ext.Loader.setConfig({
enabled: true
});

Ext.application({
name: 'NS',
//autoCreateViewport: true
launch: function() {
Ext.create('CPY.view.Viewport');
}
});


my Viewport.js
Ext.define('NS.view.Viewport',{
extend: 'Ext.container.Viewport',
xtype:'cviewport',

requires:[
'NS.view.cToolbar',
'NS.view.dictionaryView'
],

layout: 'border',
items:[{
region: 'north',
xtype: 'cpyToolbar'
},{
region: 'center',
xtype: 'cdictionaryview'
}]

});


my dictionaryView.js
Ext.define('CPY.view.dictionaryView',{
extend: 'Ext.panel.Panel',
xtype: 'cdictionaryview',

id: 'cdicview',
layout:'border',
border: false,

requires:['CPY.view.dicTree'],

items:[{
xtype: 'dicTree',
flex: 1,
region: 'west'
},{
title: 'column2',
region: 'center',
flex: 3
},{
title: 'column3',
region: 'east',
flex: 2
}]
});


my dicTree.js
Ext.define('NS.view.dicTree',{
extent: 'Ext.tree.Panel',
xtype: 'dicTree',

title: 'title show',
id: 'cdictree',
root: {
text: 'Root',
expanded: true,
children: [
{
text: 'node-1',
leaf: true
},
{
text: 'node-2',
leaf: true
},
{
text: 'node-3',
expanded: true,
children: [
{
text: 'node3-1',
leaf: true
}
]
}
]
}
})



but is error:


Uncaught TypeError: Object [object Object] has no method 'getItemId' ext-all-debug.js:30568
Ext.define.getComponentIdext-all-debug.js:30568
Ext.define.insertext-all-debug.js:29126
Ext.define.addext-all-debug.js:30609
Ext.define.initItemsext-all-debug.js:30430
Base.implement.callParentext-all-debug.js:3813
Ext.define.initItemsext-all-debug.js:42728
Ext.define.initComponentext-all-debug.js:30414
Base.implement.callParentext-all-debug.js:3813
Ext.define.initComponentext-all-debug.js:42718
Base.implement.callParentext-all-debug.js:3813
Ext.define.initComponentext-all-debug.js:48608
Base.implement.callParentext-all-debug.js:3813
Ext.define.initComponentapp/view/dictionaryView.js:29
Ext.define.constructorext-all-debug.js:21516
Base.implement.callParentext-all-debug.js:3813
Ext.define.constructorext-all-debug.js:24587
constructorext-all-debug.js:4437
Ext.apply.widgetext-all-debug.js:5247
Ext.define.createext-all-debug.js:9836
Ext.define.lookupComponentext-all-debug.js:30563
Ext.define.prepareItemsext-all-debug.js:30535
Ext.define.addext-all-debug.js:30586
Ext.define.initItemsext-all-debug.js:30430
Ext.define.initComponentext-all-debug.js:30414
Base.implement.callParentext-all-debug.js:3813
Ext.define.initComponentext-all-debug.js:62606
Ext.define.constructorext-all-debug.js:21516
Base.implement.callParentext-all-debug.js:3813
Ext.define.constructorext-all-debug.js:24587
constructorext-all-debug.js:4437
(anonymous function)
Ext.ClassManager.instantiateext-all-debug.js:5023
(anonymous function)ext-all-debug.js:1887
Ext.application.launchapp.js:11
Ext.define.onBeforeLaunchext-all-debug.js:51301
(anonymous function)ext-all-debug.js:51277
(anonymous function)ext-all-debug.js:8746
fireext-all-debug.js:8896
event.fireext-all-debug.js:10665
Ext.apply.fireReadyEventext-all-debug.js:10744
(anonymous function)



What is this cause, or say I forget configuration other options

mitchellsimoens
21 Nov 2012, 9:38 AM
Just looking at your code it all looks good, don't know what NS.view.cToolbar is. Remove some components and see what component breaks things.