I am trying to use JQgrid and edit my objects. However, I don't know how to pass parameters to the server side code. Here is my jq code:
jQuery("#tblList").jqGrid({
url: 'CityList.aspx/GetList',
editurl: 'CityList.aspx/GetList',
mtype: 'POST',
datatype: 'json',
postData: { searchString: '', searchField: '', searchOper: '' },
ajaxGridOptions: { contentType: "application/json" },
serializeGridData: function (postData) {
var propertyName, propertyValue, dataToSend = {};
for (propertyName in postData) {
if (postData.hasOwnProperty(propertyName)) {
propertyValue = postData[propertyName];
if ($.isFunction(propertyValue)) {
dataToSend[propertyName] = propertyValue();
} else {
dataToSend[propertyName] = propertyValue
}
}
}
return JSON.stringify(dataToSend);
},
jsonReader: {
root: "d.rows",
page: "d.page",
total: "d.total",
records: "d.records"
},
colNames: ['Id', 'Şehir Adı'],
colModel: [
{ name: 'CityId', index: 'CityId', hidden: true },
{ name: 'Name', index: 'Name', width: 400, editable: true, edittype: 'text' }
],
ondblClickRow: function (id) { alert("You double click row with id: " + id); },
pager: '#tblPager',
rowList: [10, 20, 30],
sortname: 'CityId',
sortorder: 'desc',
rowNum: 10,
loadtext: "Yukleniyor....",
shrinkToFit: false,
multiselect: false,
emptyrecords: "Kayit Bulunamadi",
autowidth: true,
shrinkToFit: true,
height: "400",
rownumbers: true,
//subGrid: true,
caption: 'Şehirler'
}).navGrid('#tblPager', { add: true, edit: true, del: true, reload: true });
});
jQuery("#tblList").editGridRow(rowid, properties);
I am new to jqGrid, Can you tell me how I can edit my records?