js EasyUI前台 全选的实现

 

 

在页面数据列表<d:table>

                   </d:table>   加入代码

 <d:col style="width:45"   class="display_leftalign"  title="选择<input type=\"checkbox\" id=\"checkAll\"/>">
      <input type="checkbox" name="Id" id="Id" class="checkItem" value="${row.id}"/>
 </d:col> 

js全选效果的实现

$(document).ready(function(){
        var chk_options = { 
            all:'#checkAll',
            item:'.checkItem'
        };
        $(this).chk_init(chk_options);
    });
function inputs(id){
    /*     var strChk="";
            var chkObj = $("input[@type=checkbox]:checked");
                    $.each(chkObj, function(i,item){
                        if($(item).val()!='on' && $(item).val()!=''){
                       strChk += ($(item).val()+",");  
                       }
                    });
        if($("input[@type=checkbox]:checked").size()==0){
            top.easyAlert('提示信息','请勾选要发送OA的记录!','info');
        }else{
            top.easyConfirm('提示', '确定发送?', function(r){
                if (r){
                    $('#queryForm').attr("action","report-apple!commitAllReport.action");
                    $('#queryForm').submit();
                }
            });        
        } */
        if($("input[@type=checkbox]:checked").size()==0){
            top.easyAlert('提示信息','请勾选要发送OA的记录!','info');
            return;
        }
        if($("input[@type=checkbox]:checked").size()>1){
            top.easyAlert('提示信息','只能勾选一条记录!','info');
            return;
        }
        $('#queryForm').attr("action","report-apple!commitAllReport.action");
        $('#queryForm').submit();
}

 后台  接受ID,,或者ID[] 数组即可

posted @ 2016-05-24 20:45  Vip灬cnblog  阅读(378)  评论(0编辑  收藏  举报