DWZ 实现批量修改功能。

前端时间需要写这个功能。主要思路是利用dwz自带的单个修改和批量删除功能。批量删除功能通过ajax,没有弹出dialog对话框,所以要结合一下。

<li><a class="edit"  title="单价修改" href="${path}/fwxxwh/form"   rel="ids" target="pldialog"   mask=true maxable=true minable=true resizable=true drawable=true   height="350"  ><span>单价批量修改</span></a></li>


修改dwz.min.js  在$("a[target=dialog]",$p).each(function(){ 前面加上下面的代码,下面的代码 由 dialog和selectedTodo(批量删除,通过ajax) 组成。

function _getIds(selectedIds){
    var ids="";
    var targetType="";
    var $box=targetType=="dialog"?$.pdialog.getCurrent():navTab.getCurrentPanel();
    $box.find("input:checked").filter("[name='"+selectedIds+"']").each(function(i){
    var val=$(this).val();
    ids+=i==0?val:","+val;});
    return ids;}


$("a[target=pldialog]",$p).each(function(){
    
    var $this=$(this);
    var selectedIds=$this.attr("rel")||"ids";
$(this).click(function(event){
    var ids=_getIds(selectedIds);
    alert(ids);
    if(!ids){
    alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
    return false;}
    
var $this=$(this);
var title=$this.attr("title")||$this.text();
var rel=$this.attr("rel")||"_blank";
var options={};
var w=$this.attr("width");
var h=$this.attr("height");
if(w)options.width=w;
if(h)options.height=h;
options.max=eval($this.attr("max")||"false");
options.mask=eval($this.attr("mask")||"false");
options.maxable=eval($this.attr("maxable")||"true");
options.minable=eval($this.attr("minable")||"true");
options.fresh=eval($this.attr("fresh")||"true");
options.resizable=eval($this.attr("resizable")||"true");
options.drawable=eval($this.attr("drawable")||"true");
options.close=eval($this.attr("close")||"");
options.param=$this.attr("param")||"";
var url=unescape($this.attr("href")+"/"+ids).replaceTmById($(event.target).parents(".unitBox:first"));
DWZ.debug(url);
if(!url.isFinishedTm()){
alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
return false;}
$.pdialog.open(url,rel,title,options);
return false;});});




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值