1
Help for ParamQuery Grid (free version) / Re: Sending editable: false Columns Remotely When Adding Row
« on: November 10, 2017, 06:15:15 am »
This issue is grid.commit not firing when the colModel allows nullable numbers. Sending editable: false columns back to the server is not the issue.
When adding a blank row, nullable number values have to be added to rowData as null or grid.commit will not fire. Example code below.
In addition, editable: false, dataType: "float" columns had to be changed to dataType: "string" to fire grid.commit.
After these changes grid.commit fires when addList is returned. This allows the recIndx to be updated and eliminates primary key issues.
When adding a blank row, nullable number values have to be added to rowData as null or grid.commit will not fire. Example code below.
Code: [Select]
var rowIndx = $grid.pqGrid("addRow", { rowData: {
//Handle nullable number values
Purchase_Price: null,
Rate_Per_Hour: null,
Sell_Price: null,
Year_Model: null
}
In addition, editable: false, dataType: "float" columns had to be changed to dataType: "string" to fire grid.commit.
Code: [Select]
{
title: "Depreciation Years", dataType: "string", dataIndx: "Depreciation_Years", width: 100, editable: false,
render: function (ui) {
var cellData = ui.cellData;
var rowData = ui.rowData[2];
console.log(rowData);
if (cellData != null && cellData != "") {
return parseFloat(ui.cellData).toFixed(2);
}
}
},
{
title: "NBV", dataType: "string", dataIndx: "Net_Book_Value", width: 100, align: 'right', editable: false,
render: function (ui) {
var cellData = ui.cellData;
if (cellData != null && cellData != "") {
return "$" + parseFloat(ui.cellData).toFixed(2);
}
}
},
After these changes grid.commit fires when addList is returned. This allows the recIndx to be updated and eliminates primary key issues.