PDA

View Full Version : Round and Format itemTpl



won.rhee
29 Nov 2011, 3:03 PM
Quick question:



items : [{
xtype:'list',
itemTpl:'{StoreCode} : {StoreName} ({distance})',
store: MyApp.stores.mydata
}]


I want to format and round {distance} to 100th. 123.12
How can I do this?
Thanks

mitchellsimoens
29 Nov 2011, 3:40 PM
In an XTemplate you have the ability to have javascript within the template. If you do something like {[values.something * 10]} it will multiply values.something by 10.

Or you can hook into Ext.util.Format and create a method there that can be used in the XTemplate {something:round}