我正在尝试使用 JQgrid 并编辑我的对象。但是,我不知道如何将参数传递给服务器端代码。这是我的jq代码:
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);
我是 jqGrid 的新手,你能告诉我如何编辑我的记录吗?