var sjyjTable;var selectedsjyjArr = [];//审计依据var sjyjDataTable = function() { sjyjTable = $('#sjyjTable').DataTable({ destroy: true, serverSide : true, responsive : true, processing : true, autoWidth : true,// 自动计算列宽 deferRender : true,// 设置延迟渲染,提高效率用 draw : false, searching: false, bLengthChange: false, order : [ 1, 'asc' ], ajax : { url : "basic/getSjyj", type : "POST", data : function(d) { var sentJson = GET_SENT_JSON(d); return sentJson; }, error : function(e) { ALERT_ERROR(sjyjTable, e); }, }, lengthMenu : PAGELENGTH, "language" : LANGUAGESETTING, columnDefs : [ { "targets": 0 ,"name":"fgdm","title": "", "width": "5%", orderable:false,}, { "targets": 1 ,"name":"fgdm","title": "法规代码","visible": true,"width": "15%" , orderable :false ,}, { "targets": 2 ,"name":"wjh","title": "文件号" ,"visible": true,"width": "15%" , orderable :false ,}, { "targets": 3 ,"name":"fgmc","title": "法规名称" ,"visible": true,"width": "65%" , orderable :false ,}, ], columns: [ { "sClass": "text-center", "data": "fgmc", "render": function (data, type, row, meta) { return ''; }, }, { data: 'fgdm'}, { data: 'wjh' }, { data: 'fgmc' }, ], "rowCallback": function( row, data, index ) { for(var i = 0 ; i < selectedsjyjArr.length ; i++) { var fgmc = data.fgmc; var wjh = data.wjh; if(fgmc == selectedsjyjArr[i].fgmc && wjh == selectedsjyjArr[i].wjh) { row.children[0].innerHTML = ''; }; } } }); /*$('#sjyjTable tbody tr').die().live('click',function(){ var nData = $('#sjyjTable').DataTable().row(this).data() if ($(this).find(":checkbox").prop("checked")){ $(this).find(":checkbox").removeAttr("checked"); var wjh = nData.wjh; var fgmc = nData.fgmc; for(var m = 0 ; m < selectedsjyjArr.length ; m++) { if(fgmc == selectedsjyjArr[m].fgmc && wjh == selectedsjyjArr[m].wjh) { selectedsjyjArr.splice(m, 1); } } }else { $(this).find(":checkbox").prop("checked", true); selectedsjyjArr.push(nData); } });双击$("#sjyjTable tbody tr").live('dblclick',function(e){ var nData = $('#sjyjTable').DataTable().row(this).data() })*/ //鼠标移动添加背景颜色 mouseEvent("sjyjTable"); /** * checkBox选择方法 */ sjyjTable.on( 'click', '.checkchild_sjyj', function (e) { var checked = $(this).is(":checked"); nRow = $(this).parents('tr')[0]; var nData = sjyjTable.row( nRow ).data() if (checked) { selectedsjyjArr.push(nData); } else { var fgmc = nData.fgmc; var wjh = nData.wjh; for(var m = 0 ; m < selectedsjyjArr.length ; m++) { if(fgmc == selectedsjyjArr[m].fgmc && wjh == selectedsjyjArr[m].wjh) { selectedsjyjArr.splice(m, 1); } } } });}//按钮点击处理var handleBtnClicksjyjCom = function(){ //审计依据事件 $("#btn_sjyj").on('click', function() { //修改时回显已选中的审计依据 var aArr = $("#sjyj_div a"); if(aArr.length == 0){ selectedsjyjArr = []; } for(var i = 0; i"+"["+selectedsjyjArr[i+j].wjh+"]"+selectedsjyjArr[i+j].fgmc+" "; } var lLine = document.createElement('td'); lLine.innerHTML = content; lRow.appendChild(lLine); } } $("#sjyj_div").append(Table); $("#sjyjSearch").modal('hide'); return false; }); }