Posts

Showing posts from April, 2011

Clear canvas raphael style when using draw component in Extjs4

I was moving some code from raphael.js into ExtJs4 beta 1, and I found this very useful; //in rapheal paper.clear(); //in Extjs4 paper.surface.removeAll(); (Here paper is an instance of a draw component)

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);

Url for json in an Grails / Extjs project

If you're using Extjs and grails togther you probably want to keep you JSON under the js directory. However in your application.js if you define regModel with a proxy and a url like; url : 'storetestusers.json' Your application.js won't find it in the js directory as its resolving the url relative to the gsp page, so will look in the same directory as the page. But if you change the url to; url : '../js/storetestusers.json' in a default grails project this will find the json file. nice and easy!