Jqgrid add后添加数据的层没自动关闭 5
Jqgridadd后添加数据的层没自动关闭,里面填入的数据也没清空,属性写了不起作用,请大神看看。代码如下:jQuery("#table_list_2").jqGrid(...
Jqgrid add后添加数据的层没自动关闭,里面填入的数据也没清空,属性写了不起作用,请大神看看。
代码如下:
jQuery("#table_list_2").jqGrid('navGrid', '#pager_list_2',
{ add: true, del: true, search: false, refresh: true, edittext: "编辑", addtext: "添加", deltext: "删除"},
{
//edit
closeOnEscape: true,//Closes the popup on pressing escape key
reloadAfterSubmit: true,
drag: true,
afterSubmit: function (response, postdata) {
alert(response.responseText);
if (response.responseText == "") {
alert('null')
$(this).jqGrid('setGridParam', { datatype: 'json' }).trigger('reloadGrid');//Reloads the grid after edit
return [true, '']
}
else {
$(this).jqGrid('setGridParam', { datatype: 'json' }).trigger('reloadGrid'); //Reloads the grid after edit
return [false, response.responseText]//Captures and displays the response text on th Edit window
}
},
editData: {
EmpId: function () {
var sel_id = $('#table_list_2').jqGrid('getGridParam', 'selrow');
var value = $('#table_list_2').jqGrid('getCell', sel_id, 'Id');
return value;
}
},
},
{
//add
closeAfterAdd: true,//Closes the add window after add
clearAfterAdd:true,
afterSubmit: function (response, postdata) {
if (response.responseText == "") {
$(this).jqGrid('setGridParam',
{ datatype: 'json' }, "first").trigger('reloadGrid')//Reloads the grid after Add
return [true, '']
}
else {
$(this).jqGrid('setGridParam',
{ datatype: 'json' }, "first").trigger('reloadGrid')//Reloads the grid after Add
return [false, response.responseText]
}
}
} 展开
代码如下:
jQuery("#table_list_2").jqGrid('navGrid', '#pager_list_2',
{ add: true, del: true, search: false, refresh: true, edittext: "编辑", addtext: "添加", deltext: "删除"},
{
//edit
closeOnEscape: true,//Closes the popup on pressing escape key
reloadAfterSubmit: true,
drag: true,
afterSubmit: function (response, postdata) {
alert(response.responseText);
if (response.responseText == "") {
alert('null')
$(this).jqGrid('setGridParam', { datatype: 'json' }).trigger('reloadGrid');//Reloads the grid after edit
return [true, '']
}
else {
$(this).jqGrid('setGridParam', { datatype: 'json' }).trigger('reloadGrid'); //Reloads the grid after edit
return [false, response.responseText]//Captures and displays the response text on th Edit window
}
},
editData: {
EmpId: function () {
var sel_id = $('#table_list_2').jqGrid('getGridParam', 'selrow');
var value = $('#table_list_2').jqGrid('getCell', sel_id, 'Id');
return value;
}
},
},
{
//add
closeAfterAdd: true,//Closes the add window after add
clearAfterAdd:true,
afterSubmit: function (response, postdata) {
if (response.responseText == "") {
$(this).jqGrid('setGridParam',
{ datatype: 'json' }, "first").trigger('reloadGrid')//Reloads the grid after Add
return [true, '']
}
else {
$(this).jqGrid('setGridParam',
{ datatype: 'json' }, "first").trigger('reloadGrid')//Reloads the grid after Add
return [false, response.responseText]
}
}
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询