PDA

View Full Version : Draw component's surface problem



firblazer
16 Feb 2013, 5:28 AM
Hi! I am trying to create a box:



var drawComponent = Ext.create('Ext.draw.Component',
{
itemId: 'drawComponent',
width: 500,
height: 500
});

var surface = drawComponent.surface;
var areas = Ext.create('Ext.Panel',
{
id: 'images-view',
frame: true,
collapsible: false,
width: 1000,
height: 500,
title: 'Layout',items: drawComponent
});
But the web browser javascript gives an error, says: "Suface is null or not an object". Please help. Thanks.

sword-it
16 Feb 2013, 6:07 AM
Hi firblazer,

Try this sample example-


var drawComponent = Ext.create('Ext.draw.Component', {
viewBox: false,
items: [{
type: 'circle',
fill: '#79BB3F',
radius: 100,
x: 100,
y: 100
}]
});


Ext.create('Ext.panel.Panel', {
width: 215,
height: 235,
layout: 'fit',
renderTo:Ext.getBody(),
items: [drawComponent]
});

http://jsfiddle.net/c95A3/1/

firblazer
17 Feb 2013, 12:56 AM
Thanks. It works.