使用jqgrid 删除后返回信息。
2017-06-29 15:16
429 查看
JS代码
function ondelRow(){
var ids=$("#table_list").jqGrid("getGridParam","selarrrow");//获取选中的行(数组)
if(ids.length>0){
var id = ids.toString();
$.post("${ctx}/pems/property/deleteAll",{"ids":id},function(data) {
var s=2;
if(data.indexOf("除成")>0){
s=1;
}
layer.msg(data, {icon:s});
refresh();
});
}else{
layer.alert('请先选择数据', {
skin: 'demo-class',
icon: 2,
time: 3500,
title:'提示',
offset: '150px',
closeBtn: 0
})
}
}
JSP代码
<button class="my_button btn" onclick="ondelRow()" data-toggle="tooltip" data-placement="top"><i class="fa fa-trash-o"> 删除</i> </button>
后台代码
@ResponseBody //注解,自动将string转换成json返回给ajax
@RequiresPermissions("pems:property:del")
@RequestMapping(value = "deleteAll")
public String deleteAll(String ids, Model model) {
String idArray[] =ids.split(",");
int code=0;
int sum=0;
for(String id : idArray){
Building judge = buildingService.selectById1(propertyService.get(id).getId());
//判断如果物业下没有楼座就可以删除
if(judge==null){
try{
code = propertyService.delete10(propertyService.get(id));
if (code!=1) {
return "删除失败,请联系管理员";
}else {
sum+=1;
}
}catch(Exception e){
return "系统错误,请联系管理员";
}
// propertyService.delete(propertyService.get(id));
}else{
return "成功删除"+sum+"条数据!"+ "物业"+propertyService.get(id).getName()+"下有楼座,不能删除";
// return "redirect:"+adminPath+"/pems/property/list?repage";
}
}
return "删除成功"+sum+"条数据!";
function ondelRow(){
var ids=$("#table_list").jqGrid("getGridParam","selarrrow");//获取选中的行(数组)
if(ids.length>0){
var id = ids.toString();
$.post("${ctx}/pems/property/deleteAll",{"ids":id},function(data) {
var s=2;
if(data.indexOf("除成")>0){
s=1;
}
layer.msg(data, {icon:s});
refresh();
});
}else{
layer.alert('请先选择数据', {
skin: 'demo-class',
icon: 2,
time: 3500,
title:'提示',
offset: '150px',
closeBtn: 0
})
}
}
JSP代码
<button class="my_button btn" onclick="ondelRow()" data-toggle="tooltip" data-placement="top"><i class="fa fa-trash-o"> 删除</i> </button>
后台代码
@ResponseBody //注解,自动将string转换成json返回给ajax
@RequiresPermissions("pems:property:del")
@RequestMapping(value = "deleteAll")
public String deleteAll(String ids, Model model) {
String idArray[] =ids.split(",");
int code=0;
int sum=0;
for(String id : idArray){
Building judge = buildingService.selectById1(propertyService.get(id).getId());
//判断如果物业下没有楼座就可以删除
if(judge==null){
try{
code = propertyService.delete10(propertyService.get(id));
if (code!=1) {
return "删除失败,请联系管理员";
}else {
sum+=1;
}
}catch(Exception e){
return "系统错误,请联系管理员";
}
// propertyService.delete(propertyService.get(id));
}else{
return "成功删除"+sum+"条数据!"+ "物业"+propertyService.get(id).getName()+"下有楼座,不能删除";
// return "redirect:"+adminPath+"/pems/property/list?repage";
}
}
return "删除成功"+sum+"条数据!";
相关文章推荐
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第十八节 在本地电脑的地址解析协议(ARP )表中创建和删除一个ARP
- 使用handler"不落地"返回图片信息
- 使用ntdsutil删除辅助域控信息
- 使用javascript 返回当前浏览器的版本名字信息
- 配置错误:未能使用提供程序“RsaProtectedConfigurationProvider”进行解密。提供程序返回错误信息为: 打不开 RSA 密钥容器。
- 利用Ajax返回用户ID是否已被使用的检测信息
- 豆瓣学习 返回请求码的使用 覆写程序崩溃 提示信息等
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第二十一节 增加和删除一个IP地址
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第十八节 在本地电脑的地址解析协议(ARP )表中创建和删除一个ARP
- GridView使用技巧之:新增记录、GridView内数据验证、删除信息提示
- 使用DataGrid中删除某数据如何出现提示信息????
- 使用引用形参返回额外的信息
- delphi 使用API返回网页信息
- 配置错误:未能使用提供程序“RsaProtectedConfigurationProvider”进行解密。提供程序返回错误信息为: 打不开 RSA 密钥容器。
- 初学DataGrid------使用DataGrid中删除某数据如何出现提示信息
- 在vb中使用Iphlpapi.dll获取网络信息 第二章 第二十一节 增加和删除一个IP地址
- GridView使用技巧之:新增记录、GridView内数据验证、删除信息提示等
- 配置错误:未能使用提供程序“RsaProtectedConfigurationProvider”进行解密。提供程序返回错误信息为: 打不开 RSA 密钥容器
- 配置错误:未能使用提供程序“RsaProtectedConfigurationProvider”进行解密。提供程序返回错误信息为: 打不开 RSA 密钥容器。
- 配置错误:未能使用提供程序“RsaProtectedConfigurationProvider”进行解密。提供程序返回错误信息为: 打不开 RSA 密钥容器。