我想在关闭jqgrid中的编辑表单后调用一个函数。
这是如何实现的?非常感谢。
这是编辑表单代码的开头。
jQuery("#PClist")
.jqGrid('navGrid','#pagerPC',{edit:true, add:true, del:true, search:false, refresh:false},
//Edit Section
{modal:true, closeAfterEdit:true, reloadAfterSubmit: true, closeOnEscape:true, editCaption: "Edit Record.", bSubmit:"Save and Close", width:450, recreateForm: true,
beforeShowForm: function(form) {
更新的信息:显然“beforeShowForm”必须是最后一个。我在结尾处添加了“inClose”,并且在“beforeShowForm”方法之后插入的逗号出现语法错误。
此代码有效:
jQuery("#PClist")
.jqGrid('navGrid','#pagerPC',{edit:true, add:true, del:true, search:false, refresh:false},
//Edit Section
{modal:true, closeAfterEdit:true, reloadAfterSubmit: true, closeOnEscape:true, editCaption: "Edit Record.", bSubmit:"Save and Close", width:450, recreateForm: true,
onClose: function() { alert("In onClose"); }, beforeShowForm: function(form) {
答案 0 :(得分:0)
You can use onClose
callback parameter of form editing (like beforeShowForm
callback which you already use). Try
onClose: function() {
alert("In onClose");
}
The results could be a little different depend on the version of jqGrid and the fork which you use. I tried the code in current version (4.10.0) of free jqGrid and it works as expected.
UPDATED:
jQuery("#PClist").jqGrid('navGrid', '#pagerPC',
{edit:true, add:true, del:true, search:false, refresh:false},
//Edit Section
{
modal:true,
closeAfterEdit:true,
reloadAfterSubmit: true,
closeOnEscape:true,
editCaption: "Edit Record.",
bSubmit:"Save and Close",
width:450,
recreateForm: true,
beforeShowForm: function(form) {
/*some code*/
},
onClose: function() {
alert("In onClose");
}
}
);
答案 1 :(得分:0)
这是我试过的代码。
jQuery("#PClist")
.jqGrid('navGrid','#pagerPC',{edit:true, add:true, del:true, search:false, refresh:false},
//Edit Section
{modal:true, closeAfterEdit:true, reloadAfterSubmit: true, closeOnEscape:true, editCaption: "Edit Record.", bSubmit:"Save and Close", width:450, recreateForm: true,
beforeShowForm: function(form), onClose: function() { alert("In onClose"); } {
导致:“Uncaught SyntaxError:Unexpected token,”