【发布时间】:2016-01-12 20:42:17
【问题描述】:
当行处于编辑模式(内联编辑)并且用户单击删除(导航网格)时,我在传递其他删除数据时遇到问题。
这是我的代码:
.navGrid('#' + childGridPagerID, {add: false,edit: true,del: true, cancel: true, refresh: true, view: true, search:false},{},
{// edit options
editCaption: "Exercise Special Note",template: template,
errorTextFormat: function (data) {
return 'Error: ' + data.responseText
},
},
{ // del options
mtype:"POST", reloadAfterSubmit:true, serializeDelData: function (postdata) {
var selRowId = $("#" + childGridID).jqGrid ('getGridParam', 'selrow');
//console.log(selRowID);
if ($("#"+selRowId).attr("editable") === "1") {
$("#" + childGridID).editRow(selRowId, false);
var rowdata = $("#" + childGridID).getRowData(selRowId);
}
console.log(rowdata);
// append postdata with any information
}
}
)
我知道文档说 getRowData 在编辑模式下不起作用,所以我尝试在调用 getRowData 之前禁用编辑模式,但仍然在控制台日志中获取 html 而不是真实数据。我还看到我可以先保存该行,然后在删除之前获取我的数据,问题是大多数字段都是必需的,用户可能会在不填写所有字段的情况下删除该行,这会提示用户输入必填字段.
【问题讨论】: