springmvc DWZ框架 选中行取值 alertMsg.confirm()方法
//删除 onclick方法进入deleteshop方法
function deleteshop() {
var shopid = $("#tableshoplist").find(".selected").attr("rel"); //选中行取值
alertMsg.confirm("确定要删除该设备吗?", { //框架下的信息弹出框
okCall: function(){ //确定回调函数
$.ajax({
url:"${ctx}/beauty/deleteShop?id="+shopid,
type:'GET',
cache:false,
error:function(){
alertMsg.warn('请正确操作!');
},
success:function(data){
if(data ==0)
{
// layer.msg("正在使用中,无法删除!");
alertMsg.warn('正在使用中,无法删除!');
}
else
{
alertMsg.correct('删除成功!');
navTab.reloadFlag("beauty");
}
}
});
},
cancelCall : function() {}
});
}
后台Controlleer部分
@RequestMapping("/deleteShop")
@ResponseBody
public String deleteShop(int id) { //接收参数
try {
btyshopService.delectbtyshop(id);
} catch (Exception e) {
return "0";
}
return "1";
}
}
---------------------------------------------------------------------------------------------------------------------------------------------------
第二种参数传递方式
function search() {
var psize = $("#nowPageSize", navTab.getCurrentPanel()).val();
var Searchinstid = $("#Searchinstid", navTab.getCurrentPanel()).val();
var Searchname = $("#Searchname", navTab.getCurrentPanel()).val();
if (Searchname == "") {
Searchname = "all";
}
Searchname = encodeURIComponent(encodeURIComponent(Searchname));
navTab.openTab("beauty", "${ctx}/beauty/Search/" + Searchname + "/"
+ Searchinstid, {
title : "美容店管理",
fresh : true,
data : {
page : 1,
rows : psize
}
});
}
//后台Controller部分
//分页查询
@RequestMapping(value="/Search/{Searchname}/{Searchinstid}", method = RequestMethod.GET) //接收参数
public String Search(
@RequestParam(required = false, defaultValue = "1") int page,
@RequestParam(required = false, defaultValue = "20") int rows,
@PathVariable("Searchname") String shopname,
@PathVariable("Searchinstid") Integer institutionid, //使用参数
HttpServletRequest request, Model model){
try {
shopname = URLDecoder.decode(shopname, "UTF-8");
} catch (Exception ex) {
}
if (shopname.equals("all")) {
shopname = "";
}
PageHelper.startPage(page, rows);
List<BtyShop> list = btyshopService.SearchSearch(shopname,institutionid);
request.setAttribute("pageInfo", new PageInfo<BtyShop>(list));
List<Inst> insts = instService.getAll();
request.setAttribute("insts", insts);
request.setAttribute("shoplist", list);
// 回写查询数据
model.addAttribute("Searchshopname", shopname);
model.addAttribute("Searchinstitutionid", institutionid);
return "basic/Beautyshop";
}