我正在使用內聯編輯jQgrid與編輯操作按鈕,但aftersavefunc無法正常工作。什麼是正確的做法呢?jqgrid內聯編輯使用操作 - 無法顯示錯誤消息
我想恢復該行並顯示錯誤消息時,我從服務器接收:{「成功」:假的,「ID」:空,「消息」:「你不能這樣做」}
下面是我的代碼:
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.");
}
}
});