PDA

View Full Version : Functions in Extjs tpl?



abhi.srinu
13 Jun 2013, 4:04 AM
Hi,

I have a panel with a tpl with the given code:


{
xtype: 'panel',
id: 'pnlUserItemDetails',
tpl: Ext.create('Ext.XTemplate',
'{Id}<br>',
' <tpl foreach="guestProducts.raw.products">',
' <h3>{ProductName}<br></h2>',
' Purchased {Quantity} for {[this.getPricePaid(PricePaid)]} on {SaleDate}<hr>',
' </tpl>',

{
getPricePaid: function(n) {


return '$ '+0;
},
}
),
autoScroll: true,
title: ''
}


everything is fine except the getPricePaid function is not getting called

if i replace
{[this.getPricePaid(PricePaid)]} with
{PricePaid} it gets printed correctly

Can someone help me telling what am i doing wrong?

Thanks in advance.

droessner
13 Jun 2013, 4:53 AM
Try


{[this.getPricePaid(values.PricePaid)]}

abhi.srinu
13 Jun 2013, 5:08 AM
Yup it worked. :D:D=D>

Thanks droessner.