2013-08-21 32 views
0

如何格式化itemTpl中的数字?Sencha Touch 2 - itemTpl上的格式编号

例子:

'<div style="font-size: 9px;">Total: $ {total}</div>' <= This number {total} must be 100.00, but appears just 100

谢谢!

+0

欢迎StackOverflow的..如果你得到的答案,你需要接受它。 – Viswa

回答

0

正如@kevhender说,你可以使用Ext.XTemplatetoFixed JavaScript方法进行格式化。

更具体

itemTpl: new Ext.XTemplate(
    '<div style="font-size: 9px;">Total: $ {[this.totalFormat(values.total)]}</div>',{ 
     totalFormat : function(total) { 
      return total.toFixed(2); 
     } 
}) 
+0

工作正常!谢谢! – user2703809