PDA

View Full Version : Ext.draw.Component extension



Mycoding
31 Aug 2011, 11:37 AM
Please help me to do very simple extention on base of Ext.draw.Component

I try to do this but it doesn't work


Ext.define('Ext.testcircle',{
alias: 'widget.testcircle',
extend: 'Ext.draw.Component',
requires:[
'Ext.draw.*'
],
constructor:function(config){
Ext.applyIf(config,{
items:[{
type: 'circle',
fill: '#79BB3F',
radius: 100,
x: 100,
y: 100
}]
});
this.callParent([config]);
}
});


Ext.create('Ext.Window', {
width: 215,
height: 235,
layout: 'fit',
items: [new Ext.testcircle()]
}).show();

skirtle
1 Sep 2011, 12:53 PM
constructor: function(config) {
config = config || {};

Mycoding
9 Sep 2011, 3:41 AM
up

skirtle
9 Sep 2011, 5:14 AM
I tried the code you posted and it worked fine if I just added in the line I suggested. Without that line it explodes because config is undefined.

What exactly happens when you try it? Are you seeing any error messages?

Mycoding
9 Sep 2011, 7:08 AM
Here is errors
Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null ext-all-debug-w-comments.js:10908

I use ExtJS 4.0.2a

I should to write this error from the begining.

skirtle
9 Sep 2011, 7:22 AM
You need to move the Ext.create() call inside an Ext.onReady().