item-list.jsp中js代码
text:'删除',
iconCls:'icon-cancel',
handler:function(){
var ids =getSelectionsIds();
if(ids.length== 0){
$.messager.alert('提示','未选中商品!');
return ;
}
$.messager.confirm('确认','确定删除ID为 '+ids+' 的商品吗?',function(r){
if (r){
var params = {"ids":ids};
$.post("/item/delete",params,function(data){
if(data.status== 200){
$.messager.alert('提示','删除商品成功!',undefined,function(){
$("#itemList").datagrid("reload");
});
}
});
}
});
}
Controller中添加删除方法
@RequestMapping(value = "delete", method= RequestMethod.POST)
@ResponseBody
public SysResultdeleteItem(@RequestParam("ids") String ids) {
this.itemService.deleteByIds(ids.split(","));
returnSysResult.ok();
}