似乎使用自定义格式化程序会使单元格卡在编辑模式中,并且以前编辑的行永远不会恢复。
JS,这里定义的网格
$(priceListGrid).jqGrid({
datatype: 'local',
url: common.getServerPath() + 'controller/action',
mtype: 'POST',
jsonReader: common.jqgrid.jsonReader('Id'),
colModel: [
{ name: 'MethodCode', label: 'MethodCode', index: 'MethodCode', hidden: true },
{ name: 'PriceCode', label: 'Price Code', index: 'PriceCode', width: '20px' },
{ name: 'Description', label: 'Description', index: 'Description', width: '34px' },
{ name: 'RoundTo', label: 'RoundTo', index: 'RoundTo', width: '10px' },
{
name: 'MinPrice',
label: 'Min Pr',
index: 'MinPrice',
width: '15px',
align: 'right',
formatter: customCurFormatter,
editable: true,
editrules: {
number: true,
minValue: 0,
custom: true,
custom_func: validateMinPrice
}
}
],
caption: 'Price Entity List',
hidegrid: false,
ignoreCase: true,
viewrecords: true,
recordtext: '{2} Entity(ies).',
autowidth: true,
shrinkToFit: true,
scroll: 1,
sortname: 'PriceCode',
sortorder: 'asc',
rowNum: 500,
altRows: true,
altclass: 'gridAltRowClass',
pager: '#pagerEntityPriceListDetails',
onCellSelect: priceItemSelect,
onSelectRow: onSelectPrice,
afterSubmitCell: function (rowid) {
this.setRowData(rowid, info.Data, null);
},
loadComplete: priceListEntityLoadComplete,
loadError: function (xhr, status, error) {
common.ajax.alsJsonError(xhr, status, error);
//stopDataLoading();
}//,
//loadBeforeSend: function () { isDataLoadingCount++; },
//beforeSelectRow: function () { return !getIsDataLoading(); }
})
这是格式化程序
var customCurFormatter = function (cellvalue, options, rowObject) {
return cellvalue.toFixed(rowObject.RoundTo);
}
使用它时,与 相比formatter:currency
,当转到下一行时,单元格会卡在编辑模式。
任何想法,将不胜感激。