0
我正在嘗試使用JQgrid並編輯我的對象。但是,我不知道如何將參數傳遞給服務器端代碼。這是我的jq代碼:將參數傳遞給jqGrid編輯行上的服務器端代碼
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的新手,你能告訴我如何編輯我的記錄嗎?