Decimal precision in an EXTJS grid

我与影子孤独终老i 提交于 2019-12-23 19:56:43

问题


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

回答1:


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
    }
}


来源:https://stackoverflow.com/questions/18133101/decimal-precision-in-an-extjs-grid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!