View Full Version : SOLVED: xtemplate: setting values outside <tpl for "."> ?

13 Aug 2010, 5:22 AM
I have an xtemplate for a dataview where i want to set a non-recurring value from myjsonStore.
The content is like a standfirst with recurring entries underneath.
I tried adding in a custom function but it returned the function code as a string
I assume it's not working as it's outside the tpl scope.

introTpl = new Ext.XTemplate(
'<div class="{style}">', // non-recurring value in {style} - empty on render
'<tpl for=".">',
'<div class="introTitle">{title}</div>',
'<div class="introContent">',
'<div class="introHeading">{heading}</div>',
'<div class="introCopy">{copy}</div>',
'<div class="docLink finger">{docID},{pageID}</div>',
'<img class="docLink nextBtn finger" src="img/intro-next.gif"/></div>',
I couldn't find anything on a forum search but I probably phrased it incorrectly...


13 Aug 2010, 5:41 AM
As usual, experiment with XTemplates on the Firebug console command line:

new Ext.XTemplate('<tpl for="foo">{parent.baz}</tpl>').apply({foo:{bar:'bletch'},baz:'hello!'})

13 Aug 2010, 5:56 AM
this did the job:

'div class="{[values.style]}">',