META-INF.resources.bower_components.datatables.net-fixedcolumns.js.dataTables.fixedColumns.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-data-tables Show documentation
Show all versions of jwebmp-data-tables Show documentation
The JWebSwing implementation for Data Tables
The newest version!
/*! FixedColumns 3.2.6
* ©2010-2018 SpryMedia Ltd - datatables.net/license
*/
(function(a){if(typeof define==="function"&&define.amd){define(["jquery","datatables.net"],function(b){return a(b,window,document)})}else{if(typeof exports==="object"){module.exports=function(b,c){if(!b){b=window}if(!c||!c.fn.dataTable){c=require("datatables.net")(b,c).$}return a(c,b,b.document)}}else{a(jQuery,window,document)}}}(function(f,d,a,g){var e=f.fn.dataTable;var b;var c=function(j,l){var i=this;if(!(this instanceof c)){alert("FixedColumns warning: FixedColumns must be initialised with the 'new' keyword.");return}if(l===g||l===true){l={}}var h=f.fn.dataTable.camelToHungarian;if(h){h(c.defaults,c.defaults,true);h(c.defaults,l)}var k=new f.fn.dataTable.Api(j).settings()[0];this.s={dt:k,iTableColumns:k.aoColumns.length,aiOuterWidths:[],aiInnerWidths:[],rtl:f(k.nTable).css("direction")==="rtl"};this.dom={scroller:null,header:null,body:null,footer:null,grid:{wrapper:null,dt:null,left:{wrapper:null,head:null,body:null,foot:null},right:{wrapper:null,head:null,body:null,foot:null}},clone:{left:{header:null,body:null,footer:null},right:{header:null,body:null,footer:null}}};if(k._oFixedColumns){throw"FixedColumns already initialised on this table"}k._oFixedColumns=this;if(!k._bInitComplete){k.oApi._fnCallbackReg(k,"aoInitComplete",function(){i._fnConstruct(l)},"FixedColumns")}else{this._fnConstruct(l)}};f.extend(c.prototype,{fnUpdate:function(){this._fnDraw(true)},fnRedrawLayout:function(){this._fnColCalc();this._fnGridLayout();this.fnUpdate()},fnRecalculateHeight:function(h){delete h._DTTC_iHeight;h.style.height="auto"},fnSetRowHeight:function(i,h){i.style.height=h+"px"},fnGetPosition:function(i){var h;var j=this.s.dt.oInstance;if(!f(i).parents(".DTFC_Cloned").length){return j.fnGetPosition(i)}else{if(i.nodeName.toLowerCase()==="tr"){h=f(i).index();return j.fnGetPosition(f("tr",this.s.dt.nTBody)[h])}else{var l=f(i).index();h=f(i.parentNode).index();var k=j.fnGetPosition(f("tr",this.s.dt.nTBody)[h]);return[k,l,j.oApi._fnVisibleToColumnIndex(this.s.dt,l)]}}},_fnConstruct:function(q){var m,j,h,p=this;if(typeof this.s.dt.oInstance.fnVersionCheck!="function"||this.s.dt.oInstance.fnVersionCheck("1.8.0")!==true){alert("FixedColumns "+c.VERSION+" required DataTables 1.8.0 or later. Please upgrade your DataTables installation");return}if(this.s.dt.oScroll.sX===""){this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"FixedColumns is not needed (no x-scrolling in DataTables enabled), so no action will be taken. Use 'FixedHeader' for column fixing when scrolling is not enabled");return}this.s=f.extend(true,this.s,c.defaults,q);var l=this.s.dt.oClasses;this.dom.grid.dt=f(this.s.dt.nTable).parents("div."+l.sScrollWrapper)[0];this.dom.scroller=f("div."+l.sScrollBody,this.dom.grid.dt)[0];this._fnColCalc();this._fnGridSetup();var o;var n=false;f(this.s.dt.nTableWrapper).on("mousedown.DTFC",function(i){if(i.button===0){n=true;f(a).one("mouseup",function(){n=false})}});f(this.dom.scroller).on("mouseover.DTFC touchstart.DTFC",function(){if(!n){o="main"}}).on("scroll.DTFC",function(i){if(!o&&i.originalEvent){o="main"}if(o==="main"){if(p.s.iLeftColumns>0){p.dom.grid.left.liner.scrollTop=p.dom.scroller.scrollTop}if(p.s.iRightColumns>0){p.dom.grid.right.liner.scrollTop=p.dom.scroller.scrollTop}}});var k="onwheel" in a.createElement("div")?"wheel.DTFC":"mousewheel.DTFC";if(p.s.iLeftColumns>0){f(p.dom.grid.left.liner).on("mouseover.DTFC touchstart.DTFC",function(){if(!n){o="left"}}).on("scroll.DTFC",function(i){if(!o&&i.originalEvent){o="left"}if(o==="left"){p.dom.scroller.scrollTop=p.dom.grid.left.liner.scrollTop;if(p.s.iRightColumns>0){p.dom.grid.right.liner.scrollTop=p.dom.grid.left.liner.scrollTop}}}).on(k,function(t){var i=t.type==="wheel"?-t.originalEvent.deltaX:t.originalEvent.wheelDeltaX;p.dom.scroller.scrollLeft-=i})}if(p.s.iRightColumns>0){f(p.dom.grid.right.liner).on("mouseover.DTFC touchstart.DTFC",function(){if(!n){o="right"}}).on("scroll.DTFC",function(i){if(!o&&i.originalEvent){o="right"}if(o==="right"){p.dom.scroller.scrollTop=p.dom.grid.right.liner.scrollTop;if(p.s.iLeftColumns>0){p.dom.grid.left.liner.scrollTop=p.dom.grid.right.liner.scrollTop}}}).on(k,function(t){var i=t.type==="wheel"?-t.originalEvent.deltaX:t.originalEvent.wheelDeltaX;p.dom.scroller.scrollLeft-=i})}f(d).on("resize.DTFC",function(){p._fnGridLayout.call(p)});var s=true;var r=f(this.s.dt.nTable);r.on("draw.dt.DTFC",function(){p._fnColCalc();p._fnDraw.call(p,s);s=false}).on("column-sizing.dt.DTFC",function(){p._fnColCalc();p._fnGridLayout(p)}).on("column-visibility.dt.DTFC",function(w,u,t,v,i){if(i===g||i){p._fnColCalc();p._fnGridLayout(p);p._fnDraw(true)}}).on("select.dt.DTFC deselect.dt.DTFC",function(v,u,t,i){if(v.namespace==="dt"){p._fnDraw(false)}}).on("destroy.dt.DTFC",function(){r.off(".DTFC");f(p.dom.scroller).off(".DTFC");f(d).off(".DTFC");f(p.s.dt.nTableWrapper).off(".DTFC");f(p.dom.grid.left.liner).off(".DTFC "+k);f(p.dom.grid.left.wrapper).remove();f(p.dom.grid.right.liner).off(".DTFC "+k);f(p.dom.grid.right.wrapper).remove()});this._fnGridLayout();this.s.dt.oInstance.fnDraw(false)},_fnColCalc:function(){var j=this;var i=0;var h=0;this.s.aiInnerWidths=[];this.s.aiOuterWidths=[];f.each(this.s.dt.aoColumns,function(m,l){var n=f(l.nTh);var k;if(!n.filter(":visible").length){j.s.aiInnerWidths.push(0);j.s.aiOuterWidths.push(0)}else{var o=n.outerWidth();if(j.s.aiOuterWidths.length===0){k=f(j.s.dt.nTable).css("border-left-width");o+=typeof k==="string"&&k.indexOf("px")===-1?1:parseInt(k,10)}if(j.s.aiOuterWidths.length===j.s.dt.aoColumns.length-1){k=f(j.s.dt.nTable).css("border-right-width");o+=typeof k==="string"&&k.indexOf("px")===-1?1:parseInt(k,10)}j.s.aiOuterWidths.push(o);j.s.aiInnerWidths.push(n.width());if(m