我有使用ExtJs4客户端代码的ASP.NET MVC应用程序。我是ExtJs4的新手。我有下一个代码:
columns: [
{
text: 'Money',
width: 150,
sortable: false,
dataIndex: 'Money'
}
这段代码返回值= 0000.00,因为Money是一个浮点变量,但是我需要值= 0000.我可以通过一些交互在我的渲染块中将float转换为int而不更改我的模型吗?
答案 0 :(得分:1)
使用列渲染器:
{
dataIndex: 'Money',
renderer: Ext.util.Format.numberRenderer('0000')
}
文档:http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.util.Format-method-numberRenderer
答案 1 :(得分:0)
尝试添加渲染器功能:
{
text: 'Money',
width: 150,
sortable: false,
dataIndex: 'Money',
renderer: function(value, metaData, record, rowIndex, colIndex, store) {
return Ext.util.Format.currency(value, '', 0);
}
}
但是如果你想要简单的int值,你可以:
renderer: function(value) {return ~~value;}