Forum /
Ext JS 1.x - Unsupported /
Ext 1.x: Bugs /
Compiled Templates not working as expected
Compiled Templates not working as expected
The following code works:
var spec = {
tag: 'div',
style: 'width:100%;border:1px solid blue;',
cls: 'wtf',
children: [{
tag: 'a',
href: '{0}',
children: [{
tag: 'span',
html: '{1}'
}]
}]
};
var template = YAHOO.ext.DomHelper.createTemplate(spec);
template.compile();
var el = template.append(divToolbar, ['http://www.google.com', 'boo']);
However, this does not:
var spec = {
tag: 'div',
style: 'width:100%;border:1px solid blue;',
cls: 'wtf',
children: [{
tag: 'a',
href: '{myurl}',
children: [{
tag: 'span',
html: '{mytext}'
}]
}]
};
var template = YAHOO.ext.DomHelper.createTemplate(spec);
template.compile();
var el = template.append(divToolbar,
[
{'myurl' : 'http://www.google.com', 'mytext' : 'boo'}
]
);
The problem is in the generated code:
this.compiled = function(values){ return '<div><span>' + values[mytext] + '</span> </div>';};
As you can see, the myurl reference should be 'myurl'. Same for mytext.
Also not sure if that syntax should work. Shouldn't the gen'd code look something like:
values['children'][0]['myurl']
Anyway.
Thanks.
Sencha User
There's a patch in this thread that does actually as you described.
http://www.jackslocum.com/forum/viewtopic.php?t=266
Shuda Searched First...
Shuda Searched First...
Thanks for the info. I'm still not sure, even with using the ordinal approach, how you would specify multiple children's values. Again back to your example, how would you specify more than one link (a tag) as a child of the parent div?
Thanks,
PC
Sencha User
The template would be the child (a), without the parent.
THanks
THanks
Great work. Using the library for a project now. Donations on their way.
PC
Sencha User
That sounds great to me.
Similar Threads
By Jonathan Feinberg in forum Ext 2.x: Help & Discussion
Replies: 3
Last Post: 21 Mar 2007, 1:22 PM
By gordon in forum Ext 2.x: Help & Discussion
Replies: 2
Last Post: 28 Feb 2007, 8:54 AM
By corey.gilmore in forum Ext 1.x: Help & Discussion
Replies: 7
Last Post: 8 Feb 2007, 10:03 PM
By ojintoad in forum Ext 1.x: Help & Discussion
Replies: 1
Last Post: 18 Oct 2006, 9:52 AM
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us