In my formatting, I have the following code:
formatter: {
number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }
},
and in my colModel I have:
{ name: 'SalesPrice', index: 'SalesPrice', width: 90, align: 'left', formatter:'number', editable: true, editoptions:
{
readonly: true
}
}
My data type is local
When I first show the form, I get "0.00" and not "0.0000" as I hoped. Moreover, in the built-in editing mode, the value of SalesPrice changes depending on other cells in the grid. After updates, the value of SalesPrice is displayed as an integer.
What can i do wrong?
EDIT: more complete code
$("#customerOrderLineList").jqGrid({
datatype: 'local',
formatter: {
number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }
},
colNames: [ 'Part Number', 'Sales Price'],
colModel: [
{ name: 'PartNumber', index: 'PartNum', width: 90, align: 'left', editable: true, editoptions:
{
dataInit: function (el) {
$(el).autocomplete({
source: "Autocomplete",
minLength: 1
});
}
}
},
{ name: 'SalesPrice', index: 'SalesPrice', width: 90, align: 'left', formatter: 'number',
formatoptions: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }, editable: true, editoptions:
{
readonly: true
}
}
],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortable: true,
sortname: 'PartNum',
sortorder: "asc",
viewrecords: true,
imgpath: '',
autowidth: true,
onSelectRow: function (id, status) {
if (id && id !== lastsel) {
$('#customerOrderLineList').jqGrid('restoreRow', lastsel);
$('#customerOrderLineList').jqGrid('editRow', id, true);
lastsel = id;
}
},
caption: 'Caption'
});