Results 1 to 6 of 6

Thread: Ext.draw.Component extension

  1. #1
    Sencha User Mycoding's Avatar
    Join Date
    May 2010
    Location
    Russia, Volgograd
    Posts
    460
    Vote Rating
    0
      0  

    Default Answered: Ext.draw.Component extension

    Please help me to do very simple extention on base of Ext.draw.Component

    I try to do this but it doesn't work
    Code:
    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();

  2. You need to move the Ext.create() call inside an Ext.onReady().

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585
    Vote Rating
    394
      0  

    Default

    Code:
    constructor: function(config) {
        config = config || {};

  4. #3
    Sencha User Mycoding's Avatar
    Join Date
    May 2010
    Location
    Russia, Volgograd
    Posts
    460
    Vote Rating
    0
      0  

    Default

    up

  5. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585
    Vote Rating
    394
      0  

    Default

    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?

  6. #5
    Sencha User Mycoding's Avatar
    Join Date
    May 2010
    Location
    Russia, Volgograd
    Posts
    460
    Vote Rating
    0
      0  

    Default

    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.

  7. #6
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585
    Vote Rating
    394
      0  

    Default

    You need to move the Ext.create() call inside an Ext.onReady().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •