我正在学习MVC,我告诉他使用jqgrid。其他所有工作正常,但添加弹出窗口只显示一次,即当第一次点击时显示的页面加载,但第二次点击时不显示。我找不到原因。这是我的代码。有人可以帮忙吗?
$(document).ready(function () {
$("#Add-Documents").click(function () {
$("#tblJQGrid").jqGrid('editGridRow', "new", {
url: '/SuperAdmin/AddDocuments',
addCaption: "Add Document",
bSubmit: "Submit",
bCancel: "Cancel",
bClose: "Close",
saveData: "Data has been changed! Save changes?",
bYes: "Yes",
bNo: "No",
bExit: "Cancel",
reloadAfterSubmit: true,
closeAfterAdd: true,
afterComplete: function () {
$("#tblJQGrid").trigger("reloadGrid");
}
});
});
})
答案 0 :(得分:1)
我能够通过为它做一些R& D来解决问题。我不得不添加一个额外的参数recreateForm,因为它没有在点击时重新创建新实例。新代码看起来像这样
$(document).ready(function () {
$("#Add-Documents").click(function () {
$("#tblJQGrid").jqGrid('editGridRow', "new", {
url: '/SuperAdmin/AddDocuments',
addCaption: "Add Document",
bSubmit: "Submit",
bCancel: "Cancel",
bClose: "Close",
saveData: "Data has been changed! Save changes?",
bYes: "Yes",
bNo: "No",
recreateForm: true,
bExit: "Cancel",
reloadAfterSubmit: true,
closeAfterAdd: true,
afterComplete: function () {
$("#tblJQGrid").trigger("reloadGrid");
}
});
});