私のフォーマッタには、次のコードがあります。
formatter: {
number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }
},
私のcolModelには次のものがあります:
{ name: 'SalesPrice', index: 'SalesPrice', width: 90, align: 'left', formatter:'number', editable: true, editoptions:
{
readonly: true
}
}
私のデータ型は「ローカル」に設定されています
フォームを最初に表示すると、期待していた「0.0000」ではなく「0.00」が表示されます。さらに、インライン編集モードでは、SalesPrice 値はグリッド内の他のセルに応じて変化します。更新後、SalesPrice 値は整数として表示されます。
私は何が間違っているのでしょうか?
編集:より完全なコード
$("#customerOrderLineList").jqGrid({
// url: 'someUrl',
datatype: 'local',
formatter: {
number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }
},
// mtype: 'POST',
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'
});