PDA

View Full Version : Can an XTemplates have renderer



Meila
27 Apr 2010, 1:01 AM
http://www.extjs.com/forum/images/icons/icon1.gif Can an XTemplates have renderer


Hi!
:-/

Is there a possibility to have an selfwritten renderer für data in xtemplates.
Suppose there is something like this:
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="mycontent0">',

'<span class="mycontent1" > {content1} </span>',
'<span class="mycontent2" > {content2} </span>',
'</div>',
'</tpl>'
);

Now I want to have a renderer for the - content2, but not for the content1.
I tried to overwrite the dataview.prepareData-function, but then there is not shown anything, leaving this I at least see the content in a wrong styling.
To use style-classes does not work, because I have to change the content of the content2.

Thanks for reading an hopefully for help.

Condor
27 Apr 2010, 1:42 AM
Use:

var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="mycontent0">',
'<span class="mycontent1" > {content1:this.myRenderer} </span>',
'<span class="mycontent2" > {content2} </span>',
'</div>',
'</tpl>',
{
myRenderer: function(value, values){
return '***' + value + '***'
}
}
);