-
31 Aug 2009 11:17 PM #1Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
HtmlLayout - Use Ext components in plain HTML
HtmlLayout - Use Ext components in plain HTML
HtmlLayout is a small extension of the standard ContainerLayout. It allows you to use components inside plain HTML while still maintaining the container structure. This has the advantage that the components will still be managed (e.g. destroying the container doesn't leak memory for the contained components).
The extension:
Example usage:Code:Ext.ns('Ext.ux.layout'); Ext.ux.layout.HtmlLayout = Ext.extend(Ext.layout.ContainerLayout, { renderItem: function(c, position, target){ if(c.renderTarget){ target = Ext.DomQuery.selectNode(c.renderTarget, Ext.getDom(target)); }else if(c.applyTarget){ var el = Ext.DomQuery.selectNode(c.applyTarget, Ext.getDom(target));; if(!c.rendered){ c.el = el; } target = el.parentNode; } Ext.ux.layout.HtmlLayout.superclass.renderItem.call(this, c, undefined, target); } }); Ext.Container.LAYOUTS['ux.html'] = Ext.ux.layout.HtmlLayout;
Code:Ext.onReady(function() { var panel = new Ext.Panel({ title: 'HtmlLayout test', autoHeight: true, layout: 'ux.html', html: '<table><tr><td>Please enter your name </td><td></td><td> and password </td><td><input type="password" /></td><td>.</td></tr></table>', defaultType: 'textfield', items: [{ name: 'username', renderTarget: 'td:nth(2)' },{ name: 'password', applyTarget: 'input[type=password]' }] }).render(Ext.getBody()); });
-
1 Sep 2009 1:04 AM #2
nice one! It also shows how to integrate a custom layout.
Do you ever sleep?
vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
1 Sep 2009 1:04 AM #3
-
1 Sep 2009 1:42 AM #4
Nice layout condor
Aaron Conran
@aconran
Sencha Architect Development Team
-
1 Sep 2009 10:03 AM #5
neat trick!
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
3 Sep 2009 11:22 AM #6
Yes! nice piece of lateral thinking!
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Aug 2010 9:15 AM #7
-
12 Aug 2010 10:06 AM #8
One quick question. Instead of placing the html inline in the code with the "html" config, how can I reference an html table from some other file? The reason I ask is that it is much cleaner (especially on a complex table) to have this in a separate file. Thanks.
-
12 Aug 2010 5:47 PM #9
-
15 Aug 2010 1:49 AM #10Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
@dbassett74: Instead of 'html' you could also use 'el', 'applyTo' or 'contentEl' (depending on what you are looking for exactly).


Reply With Quote