PDA

View Full Version : Ext.ux.RowExpander expects rowBodyTpl to be a string



jej2003
21 Oct 2011, 9:23 AM
I just downloaded Ext 4.0.7 and noticed in RowExpander the following:



// </debug>
// TODO: if XTemplate/Template receives a template as an arg, should
// just return it back!
var rowBodyTpl = Ext.create('Ext.XTemplate', this.rowBodyTpl),


Which for Strings works fine, but if I have a template that already exists this does not work. Previously I could do something like:



plugins: [{
ptype: 'rowexpander',
rowBodyTpl : new Ext.XTemplate(...


and the old RowExpander had this



if(this.tpl){
if(typeof this.tpl == 'string'){
this.tpl = new Ext.Template(this.tpl);
}
this.tpl.compile();
}


Is there any reason why this was changed? Is there a more appropriate way of passing in a template now? In the meantime I've modified RowExpander to do the following:



var rowBodyTpl;
if(typeof this.tpl == 'string'){
rowBodyTpl = Ext.create('Ext.XTemplate', this.rowBodyTpl);
} else {
rowBodyTpl = this.rowBodyTpl;
}
var features = [{
ftype: 'rowbody',
...

Buzzwords
10 Nov 2011, 10:05 AM
Thanks jej2003. I needed that piece of code today, to pass in an existing XTemplate. :)