【发布时间】:2016-01-21 14:12:42
【问题描述】:
我使用 jqrrid 4.6.0
- @license jqGrid 4.6.0 - jQuery 网格
- 版权所有 (c) 2008,Tony Tomov,tony@trirand.com
问题是我添加新记录后,对话框没有关闭。
$(gridSelector).jqGrid('navGrid', pagerSelector,
{
//navbar options
edit: true,
editicon: 'ace-icon fa fa-pencil blue',
add: true,
addicon: 'ace-icon fa fa-plus-circle purple',
del: true,
delicon: 'ace-icon fa fa-trash-o red',
search: true,
searchicon: 'ace-icon fa fa-search orange',
refresh: true,
refreshicon: 'ace-icon fa fa-refresh green',
view: true,
viewicon: 'ace-icon fa fa-search-plus grey'
},
{
//edit record form
//closeAfterEdit: true,
//width: 700,
recreateForm: true,
mtype: 'PUT',
onclickSubmit: function (params, postdata) {
params.url = API_URL;
},
beforeShowForm: function (e) {
var form = $(e[0]);
form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />');
styleEditForm(form);
}
},
{
//new record form
//width: 700,
closeAfterAdd: true,
recreateForm: true,
viewPagerButtons: false,
mtype: 'POST',
onclickSubmit: function (params, postdata) {
params.url = API_URL + 'PostVendor';
},
afterSubmit: function (response, postdata) {
var userKey = JSON.parse(response.responseText).UserKey;
alert("The password you created for the new vendor is\n\n" + userKey);
},
beforeShowForm: function (e) {
var form = $(e[0]);
form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar')
.wrapInner('<div class="widget-header" />');
styleEditForm(form);
}
}
但我在POST 部分中有closeAfterAdd: true。
【问题讨论】:
-
顺便说一下,我在free jqGrid的代码中做了the changes,以防止
afterSubmit或beforeSubmit不返回任何数据时出现异常。