I am using jqGrid with localArray data. I am fetching this array from azure db and binging to grid. After this on manipulation of every single row, I am planning to update it in DB.
I am using inline navigation bar. On clicking of "add row", "save row" & "delete row" button I want to call my custom function and then would like to save/delete data in DB from that function.
First I would like to know whether my design is correct and scalable or not.
At present, I am able to call custom function on click of save button using "aftersavefunc" parameter.
Second, please let me know which parameter I have to set for "delete row" button. I think for "add row", same parameter can work as we have to click "save row" button to save row.
My code is as below for reference :
jQuery("#list4").jqGrid({
datatype: "local",
data: myData,
height: "auto",
colNames: ['RowNo', 'RouteId', 'Area'],
colModel: [
{ name: 'id', index: 'id', width: 50, sortable: false },
{ name: 'RouteId', index: 'RouteId', width: 50, sortable: false },
{ name: 'Area', index: 'Area', width: 130, sortable: false, editable: true, editrules: { required: true} },
],
multiselect: false,
rownumbers: false,
rowList: [10, 20, 30],
pager: jQuery('#pager1'),
viewrecords: true,
caption: "Bus Schedule Data",
editurl: "clientArray",
restoreAfterSelect: false,
loadonce: true
});
var rowid;
var inlineparams = {
addParams: { useFormatter: false },
editParams: {
aftersavefunc: function (id) {
var rowData = jQuery('#list4').jqGrid('getRowData', id);
ScheduleTable.update({ id: 1, Area: rowData.Area.toString() });
}
},
add: true,
edit: true,
save: true,
cancel: true,
del: true
};
jQuery("#list4").jqGrid('navGrid', "#pager1", { edit: false, save: false, add: false, cancel: false, del: false });
jQuery("#list4").jqGrid('inlineNav', "#pager1", inlineparams);
jQuery("#list4").jqGrid("saveRow", id, {
keys: false,
url: "clientArray"
});