-
18 Oct 2006 7:57 AM #1
Dom Helper Named Parameters in Compiled Templates
Dom Helper Named Parameters in Compiled Templates
Do named parameters work with compiled dom templates? I've run the examples using named parameters and included the additional .compile statement but it complains that the parameters aren't defined (for your blog post one, it specifically says id is not defined, which is the first parameter). If you turn off the compile function everything runs smoothly. Using numbered parameters works fine. I ask because the blog post doesn't say that the compiled ones don't support it. It breaks in both IE and Firefox.
If it does support it, I'll post some code to see if it's something I'm doing wrong.
-
18 Oct 2006 9:52 AM #2
Named parameters were added as an afterthought and support for them wasn't added to compiled templates (my mistake). Here's a patch that fixes them:
This will be part of the next release.Code:YAHOO.ext.DomHelper.Template.prototype.compile = function(){ var html = this.html; var re = /\{(\w+)\}/g; var body = []; body.push("this.compiled = function(values){ return "); var result; var lastMatchEnd = 0; while ((result = re.exec(html)) != null){ body.push("'", html.substring(lastMatchEnd, result.index), "' + "); body.push("values['", html.substring(result.index+1,re.lastIndex-1), "'] + "); lastMatchEnd = re.lastIndex; } body.push("'", html.substr(lastMatchEnd), "';};"); eval(body.join('')); };
Similar Threads
-
DomHelper Templates not working in IE
By corey.gilmore in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 8 Feb 2007, 10:03 PM -
[solved] how to use the dom helper ???
By cobalt in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 14 Nov 2006, 9:05 AM -
Compiled Templates not working as expected
By pcbender in forum Ext 1.x: BugsReplies: 5Last Post: 20 Oct 2006, 1:08 PM -
Dom Helper Reserved Word Hack
By ojintoad in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 17 Oct 2006, 12:22 PM


Reply With Quote