码迷,mamicode.com
首页 > 其他好文 > 详细

easyUI 复选框批量操作

时间:2016-07-14 21:57:34      阅读:357      评论:0      收藏:0      [点我收藏+]

标签:

前台js代码

function destroyExcelout(){ 

             //返回选中多行 

             var row = $(‘#dg‘).datagrid(‘getSelections‘); 

             //判断是否选中行 

             if (row.length==0){ 

                 $.messager.alert("提示", "请选择要删除的行!", "info"); 

                 return

             }else{     

                   var temID=""; 

                 //批量获取选中行的评估模板ID 

             $.messager.confirm(‘提示‘, ‘是否删除选中数据?‘, function (r){                          

                      if (!r) { 

                             return

                         }

      //将id字符串连在一起

                     for (i = 0; i < row.length;i++) { 

                        if (temID =="") { 

                             temID = row[i].id; 

                         } else

                             temID = row[i].id + "," + temID; 

                         }   

                 }

                 $.post(‘__ROOT__/index.php/Comprehensive/deleteComprehensive/‘,‘id=‘+temID,function(result){

                       if (!result==false){

                            $.messager.show({     // show error message

                                 title: ‘成功‘,

                                 msg: ‘删除条目成功!‘

                            });

                            $(‘#dg‘).datagrid(‘reload‘);   // reload the user data

                            $(‘#dg‘).datagrid(‘clearSelections‘);

                       } else {

                            $.messager.show({     // show error message

                                 title: ‘失败‘,

                                 msg: ‘操作失败!!‘

                            });

                       }

                   },‘json‘);

             }); 

             }  

             $(‘#fm‘).form(‘load‘,row);

         }

 

 

后台代码

public function deleteComprehensive(){

          $sjcj=M(‘Sjcj‘);

          $strTemId=I(‘post.id‘);  

          $strid=explode(‘,‘,$strTemId);

          $value="";

          foreach ($strid as $val){

              $value.=",‘".$val."‘";

          } 

         $result=$sjcj->where("id IN (".substr($value, 1).")")->delete();

       // $result=$sjcj->where(‘id=‘.I(‘post.id‘))->delete();

        if($result==true){

        //写入日志

            $log=M(‘Log‘);

            $logData[‘operate‘]=‘删除‘;

            $logData[‘object‘]=‘t_sjcj‘;

            $logData[‘items‘]=I(‘post.tybh‘);

            $logData[‘time‘]=date(‘Y-m-d H:i:s‘);

            $logData[‘user‘]=session(‘user‘);

            $log->add($logData);

        }

        echo $result;

    }

    

}

 

easyUI 复选框批量操作

标签:

原文地址:http://www.cnblogs.com/qiyuntian/p/5671677.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!