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

Popular posts from this blog

Getting Started: Quick Setup for GXT 3 (includes reset.css link how to)

How to setup GXT 3 examples, samples and demos

ExtJs4 : Dynamically Add Columns