我正在实现jqGrid并且在编辑行时需要回调,对于添加和删除,gridComplete正在被触发但是当我编辑该行时,没有触发任何事件。我在jqGrid的文档中尝试了很多。以下是代码:
tableID.jqGrid({
// scroll:1,
altRows:true,
// ajaxGridOptions:{async:false},
data:clientSideData,
datatype: "local",
//mtype: reqType,
colNames:columnName,
colModel :columnModel,
pager: '#pager_'+wargs.uuid,
rowNum:rowNumber,
rowList:listOfRow,
sortname: sortByCol,
sortorder: sortOrder,
viewrecords: true,
caption: titleGrid,
jsonReader: { repeatitems : false},
gridview:true,
//cellsubmit:'clientArray',
//cellEdit: editable,
onSelectRow: function(id){
if(editable == "true"){
if(id && id !== lastsel){
jQuery('#list').jqGrid('restoreRow',lastsel);
jQuery('#list').jqGrid('editRow',id,true);
lastsel=id;
}
}
},
// loadonce: true,
loadBeforeSend : function(xhr) {
dataField.val(getRowDataAsJson());console.log(dataField.val());
},
gridComplete : function() {
dataField.val(getRowDataAsJson());console.log(dataField.val());
},
loadError : function(xhr,status,error){
dataField.val(getRowDataAsJson());console.log(dataField.val());
},
editurl: wargs.args.dummyURI
});
tableID.jqGrid('navGrid',"#pager_"+wargs.uuid,
{edit:editable,add:editable,del:editable},
{closeAfterEdit: editable,closeOnEscape:editable,reloadAfterSubmit:editable});
请不要担心像editable和wargs.uuid这样的值,这里没有提到它是不需要的。