PDA

View Full Version : Use sencha extjs component in non sencha based app



zonathen
18 Dec 2012, 7:37 AM
Hello I was wondering if it's possible to use a sencha component like the grid in a javascript app that is not sencha based. All the examples I see require sencha taking control of the entire page html. Is there some way to limit the scope of the sencha application to a part of a page like only where you want the grid control to display? We don't care about the overhead of pulling in the entire framework for one component btw since the grid component is so feature rich.

Sorry if this is already answered somewhere else I have googled the forums and the internets high and low but can't find an answer..

slemmon
18 Dec 2012, 12:22 PM
You should be able to drop a grid onto a page. When you create the grid use the renderTo (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel-cfg-renderTo) config and pass a div id where you want the grid to live (or even do renderTo: Ext.getBody() to render to the doc's body).

Check out this example to see it in action:
http://cdn.sencha.com/ext-4.1.1a-gpl/examples/grid/array-grid.html

zonathen
18 Dec 2012, 9:40 PM
Okay looks like that works in my tests thanks! Hmm, I wonder what the disadvantage of using as a component is other than the bloat of the entire library etc. You'd think sencha would market the use of components instead of the entire app takeover.