Decimal precision in an EXTJS grid

extjs, grid

Solution

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

Problem

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

Original source