EXTJS网格中的小数精度

编程入门 行业动态 更新时间:2024-10-22 07:39:27
本文介绍了EXTJS网格中的小数精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

因此,如果用户输入1000.1111,则结果字段将在网格中显示1000.1100。

模型中的字段如下所示:

$ b我怎样才能告诉模型该字段精确到小数点后4位? $ b

{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,渲染器:Ext.util.Format.numberRend erer('$ 0,000.0000'), dataIndex:'Price_Customer__c', summaryType:'sum',编辑器:{//字段从4.0.5开始已弃用 xtype :'numberfield', decimalPrecision:4 } }

I have a grid which lets a user enter in a number by editing the row. I want the number to support 4 decimal places, but it only supports 2. I figured out how to display 4 decimal places but it doesn't register anything more than 2 decimal places.

So if the user enters 1000.1111 the resulting field will show 1000.1100 in the grid. How can I tell the model that the field is precise to 4 decimal places?

My field in the model looks like this:

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

The column in the grid is set up like this:

{ 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' } },

解决方案

This should work:

{ 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网格中的小数精度

本文发布于:2023-11-23 01:29:00,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:小数   网格   精度   EXTJS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!