
org.wicketstuff.datatables.media.js.FixedColumns.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datatables Show documentation
Show all versions of datatables Show documentation
DataTables jQuery integration for Wicket
The newest version!
/*
* File: FixedColumns.min.js
* Version: 1.0.2
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
var FixedColumns=function(a,b){if(typeof this._fnConstruct!="function")alert("FixedColumns warning: FixedColumns must be initialised with the 'new' keyword.");else{if(typeof b=="undefined")b={};this.s={dt:a.fnSettings(),columns:1};this.dom={scroller:null,header:null,body:null,footer:null,clone:{header:null,body:null,footer:null}};this._fnConstruct(b)}};
FixedColumns.prototype={_fnConstruct:function(a){var b=this;if(typeof this.s.dt.oInstance.fnVersionCheck!="function"||this.s.dt.oInstance.fnVersionCheck("1.7.0")!==true)alert("FixedColumns 2 required DataTables 1.7.0 or later. Please upgrade your DataTables installation");else 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");
else{if(typeof a.columns!="undefined"){if(a.columns<1){this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"FixedColumns is not needed (no columns to be fixed), so no action will be taken");return}this.s.columns=a.columns}this.dom.body=this.s.dt.nTable;this.dom.scroller=this.dom.body.parentNode;this.dom.scroller.style.position="relative";this.dom.header=this.s.dt.nTHead.parentNode;this.dom.header.parentNode.parentNode.style.position="relative";if(this.s.dt.nTFoot){this.dom.footer=this.s.dt.nTFoot.parentNode;
this.dom.footer.parentNode.parentNode.style.position="relative"}$(this.dom.scroller).scroll(function(){b._fnScroll.call(b)});this.s.dt.aoDrawCallback.push({fn:function(){b._fnClone.call(b);b._fnScroll.call(b)},sName:"FixedColumns"});this._fnClone();this._fnScroll()}},_fnClone:function(){var a=this,b=0,e=[],d,g,f,h=$.browser.msie&&($.browser.version=="6.0"||$.browser.version=="7.0");d=0;for(g=this.s.columns;d0){this.dom.clone.body=$(this.dom.body).clone(true)[0];this.dom.clone.body.className+=" FixedColumns_Cloned";this.dom.clone.body.getAttribute("id")!==
null&&this.dom.clone.body.removeAttribute("id");$("thead tr:eq(0)",this.dom.clone.body).each(function(){$("th:gt("+(a.s.columns-1)+")",this).remove()});$("thead tr:gt(0)",this.dom.clone.body).remove();d=$("tbody tr:eq(0) td:eq(0)",a.dom.body);var i=d.outerHeight()-d.height();$("tbody tr",this.dom.clone.body).each(function(c){$("td:gt("+(a.s.columns-1)+")",this).remove();$.browser.mozilla||$.browser.opera?$("td",this).height($("tbody tr:eq("+c+")",a.dom.body).outerHeight()):$("td",this).height($("tbody tr:eq("+
c+")",a.dom.body).outerHeight()-i);h||$("tbody tr:eq("+c+")",a.dom.body).height($("tbody tr:eq("+c+")",a.dom.body).outerHeight())});$("tfoot tr:eq(0)",this.dom.clone.body).each(function(){$("th:gt("+(a.s.columns-1)+")",this).remove()});$("tfoot tr:gt(0)",this.dom.clone.body).remove();this.dom.clone.body.style.position="absolute";this.dom.clone.body.style.top="0px";this.dom.clone.body.style.left="0px";this.dom.clone.body.style.width=b+"px";this.dom.body.parentNode.appendChild(this.dom.clone.body)}if(this.s.dt.nTFoot!==
null){this.dom.clone.footer!==null&&this.dom.clone.footer.parentNode.removeChild(this.dom.clone.footer);this.dom.clone.footer=$(this.dom.footer).clone(true)[0];this.dom.clone.footer.className+=" FixedColumns_Cloned";$("tfoot tr:eq(0)",this.dom.clone.footer).each(function(){$("th:gt("+(a.s.columns-1)+")",this).remove();$(this).height($(a.dom.footer).height())});$("tr",this.dom.clone.footer).height($(a.dom.footer).height());$("tfoot tr:gt(0)",this.dom.clone.footer).remove();$("tfoot th",this.dom.clone.footer).each(function(c){this.style.width=
e[c]+"px"});this.dom.clone.footer.style.position="absolute";this.dom.clone.footer.style.top="0px";this.dom.clone.footer.style.left="0px";this.dom.clone.footer.style.width=b+"px";this.dom.footer.parentNode.appendChild(this.dom.clone.footer)}},_fnScroll:function(){var a=$(this.dom.scroller).scrollLeft();this.dom.clone.header.style.left=a+"px";if(this.dom.clone.body!==null)this.dom.clone.body.style.left=a+"px";if(this.dom.footer)this.dom.clone.footer.style.left=a+"px"}};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy