3 lines
13 KiB
JavaScript
3 lines
13 KiB
JavaScript
|
|
/*! jQuery DataTables Checkboxes v1.2.12 - www.gyrocode.com/projects/jquery-datatables-checkboxes/ - License: MIT - Author: Gyrocode LLC / www.gyrocode.com */
|
||
|
|
!function(c){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return c(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,t&&t.fn.dataTable||(t=require("datatables.net")(e,t).$),c(t,0,e.document)}:c(jQuery,window,document)}(function(k,e,b){"use strict";function x(e){if(!f.versionCheck||!f.versionCheck("1.10.8"))throw"DataTables Checkboxes requires DataTables 1.10.8 or newer";this.s={dt:new f.Api(e),columns:[],data:[],dataDisabled:[],ignoreSelect:!1},this.s.ctx=this.s.dt.settings()[0],this.s.ctx.checkboxes||(e.checkboxes=this)._constructor()}var f=k.fn.dataTable;x.prototype={_constructor:function(){for(var e,t,c,s,o,l,a,n=this,d=n.s.dt,i=n.s.ctx,h=!1,u=!1,r=0;r<i.aoColumns.length;r++){i.aoColumns[r].checkboxes&&(e=k(d.column(r).header()),h=!0,k.isPlainObject(i.aoColumns[r].checkboxes)||(i.aoColumns[r].checkboxes={}),i.aoColumns[r].checkboxes=k.extend({},x.defaults,i.aoColumns[r].checkboxes),t={searchable:!1,orderable:!1},""===i.aoColumns[r].sClass?t.className="dt-checkboxes-cell":t.className=i.aoColumns[r].sClass+" dt-checkboxes-cell",null===i.aoColumns[r].sWidthOrig&&(t.width="1%"),null===i.aoColumns[r].mRender&&(t.render=function(){return'<input type="checkbox" class="dt-checkboxes" autocomplete="off">'}),f.ext.internal._fnColumnOptions(i,r,t),e.removeClass("sorting"),e.off(".dt"),null===i.sAjaxSource&&((c=d.cells("tr",r)).invalidate("data"),k(c.nodes()).addClass(t.className)),n.s.data[r]={},n.s.dataDisabled[r]={},n.s.columns.push(r),i.aoColumns[r].checkboxes.selectRow&&(i._select?u=!0:i.aoColumns[r].checkboxes.selectRow=!1),i.aoColumns[r].checkboxes.selectAll&&(e.data("html",e.html()),null!==i.aoColumns[r].checkboxes.selectAllRender&&(s="",k.isFunction(i.aoColumns[r].checkboxes.selectAllRender)?s=i.aoColumns[r].checkboxes.selectAllRender():"string"==typeof i.aoColumns[r].checkboxes.selectAllRender&&(s=i.aoColumns[r].checkboxes.selectAllRender),e.html(s).addClass("dt-checkboxes-select-all").attr("data-col",r))))}h&&(n.loadState(),o=k(d.table().node()),l=k(d.table().body()),a=k(d.table().container()),u&&(o.addClass("dt-checkboxes-select"),o.on("user-select.dt.dtCheckboxes",function(e,t,c,s,o){n.onDataTablesUserSelect(e,t,c,s,o)}),o.on("select.dt.dtCheckboxes deselect.dt.dtCheckboxes",function(e,t,c,s){n.onDataTablesSelectDeselect(e,c,s)}),i._select.info&&(d.select.info(!1),o.on("draw.dt.dtCheckboxes select.dt.dtCheckboxes deselect.dt.dtCheckboxes",function(){n.showInfoSelected()}))),o.on("draw.dt.dtCheckboxes",function(e){n.onDataTablesDraw(e)}),l.on("click.dtCheckboxes","input.dt-checkboxes",function(e){n.onClick(e,this)}),a.on("click.dtCheckboxes",'thead th.dt-checkboxes-select-all input[type="checkbox"]',function(e){n.onClickSelectAll(e,this)}),a.on("click.dtCheckboxes","thead th.dt-checkboxes-select-all",function(){k('input[type="checkbox"]',this).not(":disabled").trigger("click")}),u||a.on("click.dtCheckboxes","tbody td.dt-checkboxes-cell",function(){k('input[type="checkbox"]',this).not(":disabled").trigger("click")}),a.on("click.dtCheckboxes","thead th.dt-checkboxes-select-all label, tbody td.dt-checkboxes-cell label",function(e){e.preventDefault()}),k(b).on("click.dtCheckboxes",'.fixedHeader-floating thead th.dt-checkboxes-select-all input[type="checkbox"]',function(e){i._fixedHeader&&i._fixedHeader.dom.header.floating&&n.onClickSelectAll(e,this)}),k(b).on("click.dtCheckboxes",".fixedHeader-floating thead th.dt-checkboxes-select-all",function(){i._fixedHeader&&i._fixedHeader.dom.header.floating&&k('input[type="checkbox"]',this).trigger("click")}),o.on("init.dt.dtCheckboxes",function(){setTimeout(function(){n.onDataTablesInit()},0)}),o.on("stateSaveParams.dt.dtCheckboxes",function(e,t,c){n.onDataTablesStateSave(e,t,c)}),o.one("destroy.dt.dtCheckboxes",function(e,t){n.onDataTablesDestroy(e,t)}))},onDataTablesInit:function(){var o=this,e=o.s.dt,t=o.s.ctx;t.oFeatures.bServerSide||(t.oFeatures.bStateSave&&o.updateState(),k(e.table().node()).on("xhr.dt.dtCheckboxes",function(e,t,c,s){o.onDataTablesXhr(e.settings,c,s)}))},onDataTablesUserSele
|
||
|
|
//# sourceMappingURL=dataTables.checkboxes.min.js.map
|