View Full Version : help creating BasicDialog from dynamic content through DomHelper.Template

29 Jun 2007, 3:01 PM
Hello All,

I try to create a BasicDialog using content that I append to document.body through DomHelper.Template, like this:

var tpl = new Ext.DomHelper.Template(
'<div id="{0}" {4} style="visibility:hidden;">'+
'<div class="x-dlg-hd">{1}</div>'+
'<div class="x-dlg-bd">{2}</div>'+
'<div class="x-dlg-ft">{3}</div>'+

var dialog = new Ext.BasicDialog(newpid, {
modal:true, autoTabs:true, shadow: true,
width:dimWidth, height:dimHeight, resizable: resize,
minWidth:200, minHeight:150,
proxyDrag: true });

where newpid, header, footer and props are non-empty strings.

Unfortunatelly, this does not work. I have traced the offending statement in ext-all-debug.js in the line:

this.header = el.child("/.x-dlg-hd");

I cannot understand why it barfs!

The same dialog creation code, but with the pid of an already present (i.e. created by hand) HTML element works with no problems.

This is part of a codebase that is currently at yui-ext.0.33 and I am trying to migate to ext-1.0.1. So far, this has been one of the major obstacles...

Any help, greatly appreciated.

-Stathis Rouvas

29 Jun 2007, 3:19 PM
First download the latest 1.1 beta on the chance that it's a bug that was fixed. Look at the rendered HTML in Firebug, after the append, but before dialog creation. Is it correct?

29 Jun 2007, 4:31 PM
It works!

ext-1.1-beta2 works OK!

I can't believe you replied so soon!

BTW, I'm using YUI.0.12.2 but without the ext provided yui-utilities.js (I do use the adapter). Although I plan on moving to a pure ext implementation, I'll keep using YUI libs until the migration is over. Do you think that this is "unadvisable"?

-Stathis Rouvas

PS: I'm still awed by the quick and to the point reply!

30 Jun 2007, 12:52 AM
I've just moved over to ext-base.js and removed ALL ocurrences of "YAHOO" from my codebase.

I had to implement a logger function to log to the Firebug console, but it all works beautifully.