gpt4 book ai didi

extjs - EXTJS 网格中的小数精度

转载 作者:行者123 更新时间:2023-12-04 02:49:14 25 4
gpt4 key购买 nike

我有一个网格,它允许用户通过编辑行来输入数字。我希望数字支持 4 位小数,但它只支持 2 位。我想出了如何显示 4 位小数,但它没有注册超过 2 位小数。

因此,如果用户输入 1000.1111,结果字段将在网格中显示 1000.1100。如何告诉模型该字段精确到小数点后 4 位?

模型中的字段如下所示:

{name: 'Price_Customer__c', type: 'number'},

网格中的列是这样设置的:

{
header: 'Price to Customer',
flex: 0,
width: 100,
sortable: true,
renderer: Ext.util.Format.numberRenderer('$0,000.0000'),
dataIndex: 'Price_Customer__c',
summaryType: 'sum',
field: {
xtype: 'numberfield'
}
},

最佳答案

这应该有效:

{
header: 'Price to Customer',
flex: 0,
width: 100,
sortable: true,
renderer: Ext.util.Format.numberRenderer('$0,000.0000'),
dataIndex: 'Price_Customer__c',
summaryType: 'sum',
editor: { //field has been deprecated as of 4.0.5
xtype: 'numberfield',
decimalPrecision: 4
}
}

关于extjs - EXTJS 网格中的小数精度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18133101/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com