【发布时间】:2017-01-29 09:00:47
【问题描述】:
我正在使用带有编辑操作按钮的 jQgrid 内联编辑,但 aftersavefunc 不起作用。什么是正确的做法?
当我从服务器收到时,我想恢复该行并显示错误消息:{"success":false,"id":null,"message":"You can not do that"}
以下是我的代码:
angular.element(document).ready(function () {
$("#jqGrid").jqGrid({
datatype: "local",
data: $scope.listResellerUser,
mtype: "POST",
colModel: [
{ label:'Full Name', name: 'fullname' },
{ label: 'User Name', name: 'username' },
{ label: 'User Id', name: 'userId', hidden: true, key:true },
{ label: 'Email', name: 'email' },
{ label: 'User Level', name:'roleId', index:'roleId', edittype:'select', editable:true, align:'center', formatter:'select',
editoptions:{value:setRoleDropdown()
}},
{name:'Actions',index:'Actions',width:55,align:'center',sortable:false,search: false,formatter:'actions',
formatoptions:{
keys: true, // we want use [Enter] key to save the row and [Esc] to cancel editing.
delbutton:false,
}}
],
editurl: "/myreseller/changeuserrole",
styleUI : 'Bootstrap',
page: 1,
autowidth: true,
height: 250,
rowNum: 20,
scrollPopUp:true,
scrollLeftOffset: "83%",
viewrecords: true,
scroll: 1, // set the scroll property to 1 to enable paging with scrollbar - virtual loading of records
emptyrecords: 'Scroll to bottom to retrieve new page', // the message will be displayed at the bottom
pager: "#jqGridPager",
editParams: {
"aftersavefunc": function (rowid, response, options) {
alert("row with rowid=" + rowid + " is successfuly modified.");
}
}
});
【问题讨论】:
标签: javascript jquery angularjs jqgrid