Code Snippet : Draw a rectangle in ExtJs4
A simple example of how to draw a rectangle in ExtJs4
    //init the draw component
  paper = Ext.create('Ext.draw.Component', {
        width: 1000,
        height: 900,
        renderTo: Ext.getBody()
    });
    // Add a rectangle sprite
    var myRect = paper.surface.add({
        type: 'rect',
        x: 100,
        y: 100,
        height : 600,
        width: 800,
        fill: '#ccc'
    });
  //change the fill color
    myRect.setAttributes({
        fill: '#cc5'
    }, true);
 
Comments
Post a Comment