Free jqgrid data comes as json string from server. It can contain different number of decimal places like
amount: "300.1",
tax: "20.12",
total: "320.123"
This data should appear as comma separated in jqgrid columns like
300,1 20,12 320,123
Locale file grid.locale-et.js was created for this with contents
formatter: {
integer: {
thousandsSeparator: " ",
defaultValue: "0"
},
number: {
decimalSeparator: ",",
thousandsSeparator: " ",
decimalPlaces: 2,
defaultValue: "0,00"
},
and template: 'number'
option in colmodel is used. This shows all columns with 2 digits like
300,10 20,12 320,12
How to fix this so that columns will display proper numbers of decimal places?
I tried in colmodel
"template":"number",
"decimalPlaces":4
but it still shows 2 decimal places. Without using template proper number of decimal places is shown.
Testcase is at http://jsfiddle.net/xssnr1gn/3/
It contains
{ id: "20", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.1", tax: "20.12", closed: false, ship_via: "FE", total: "320.123" },
but output is 2 decimal places for every column.
Update
If decimalPlaces: 2,
is removed, jqgrid looks like
Issues:
- decimal separator is changed to .
- There are variable number of decimal places
- The is non-understandable value
7 146 2.8
- for some numbers space appears before decimal point
Data from server contains fixed number of decimal places. How to show exactly the same number of decimal places as it is in server data ?
http://jsfiddle.net/xssnr1gn/4/
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:predefined_formatter
You need to apply the formatter and formatoptions
And full code: