在 jqgrid 中进行内联编辑后,任何人都可以帮助我获得 ajax 响应吗?下面是我在 jqgrid 中的代码,我不知道如何在内联编辑后获得 ajax 成功响应。
我尝试过使用“loadComplete”、“gridComplete”和“afterComplete”。这些仅在加载网格后才有效,但在编辑单元格后无效。
jQuery('#grid').jqGrid({
"width": "640",
"hoverrows": true,
"viewrecords": false,
"gridview": true,
"url": "es.php",
"editurl": "es.php",
"cellurl": "es.php",
"rowNum": 10,
"rowList": [10, 20, 30],
"sortname": "id",
"datatype": "json",
"colModel": [{
"name": "employee",
"sortable": false,
"index": "employee",
"editable": true,
"editrules": { required: true }
}, {
"name": "age",
"index": "age",
"sortable": false,
"editable": true,
"editrules": { required: true }
}, {
"name": "actions",
"formatter": "actions",
"editable": false,
"sortable": false,
"resizable": false,
"delbutton" : false,
"fixed": true,
"width": 60,
"formatoptions": {
"keys": true,
"delbutton" : false,
"delOptions": {},
}
}, {
name: 'id',
index: 'id',
"key": true,
hidden: true,
viewable: true,
editrules: {
edithidden: true
},
"editable": false
}
],
"postData": {
"oper": "fsgrid"
},
"prmNames": {
"page": "page",
"rows": "rows",
"sort": "sidx",
"order": "sord",
"search": "_search",
"nd": "nd",
"id": "id",
"searchField": "searchField",
"searchOper": "searchOper",
"searchString": "searchString",
"oper": "oper",
"query": "grid",
"addoper": "wsadd",
"editoper": "wsedit",
"excel": "excel",
"subgrid": "subgrid",
"totalrows": "totalrows",
},
"loadError": function(xhr, status, err) {
try {
jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap, '<div class="ui-state-error">' + xhr.responseText + '</div>', jQuery.jgrid.edit.bClose, {
buttonalign: 'right'
});
} catch (e) {
alert(xhr.responseText);
}
},
"pager": "#pager",
beforeShowForm: function(form) {
$(".ui-inline-del").remove();
},
});
jQuery('#grid').jqGrid('navGrid', '#pager', {
"edit": false,
"add": true,
"del": false,
"search": false,
"refresh": false,
"view": false,
"excel": false,
"pdf": false,
"csv": false,
"columns": false
});
有了以上内容,一切正常。但内联编辑完成后,我不知道如何获得 ajax 响应。不仅如此,我对 jqgrid 还很陌生。我想,我使用的是非常基本的 jqgrid 代码。所以请建议我得到回应。