123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029 |
- var FixedHeader;
- (function(window, document, undefined) {
- var factory = function( $, DataTable ) {
- "use strict";
- FixedHeader = function ( mTable, oInit ) {
-
- if ( ! this instanceof FixedHeader )
- {
- alert( "FixedHeader warning: FixedHeader must be initialised with the 'new' keyword." );
- return;
- }
- var that = this;
- var oSettings = {
- "aoCache": [],
- "oSides": {
- "top": true,
- "bottom": false,
- "left": 0,
- "right": 0
- },
- "oZIndexes": {
- "top": 104,
- "bottom": 103,
- "left": 102,
- "right": 101
- },
- "oCloneOnDraw": {
- "top": false,
- "bottom": false,
- "left": true,
- "right": true
- },
- "oMes": {
- "iTableWidth": 0,
- "iTableHeight": 0,
- "iTableLeft": 0,
- "iTableRight": 0,
- "iTableTop": 0,
- "iTableBottom": 0
- },
- "oOffset": {
- "top": 0
- },
- "nTable": null,
- "bFooter": false,
- "bInitComplete": false
- };
-
- this.fnGetSettings = function () {
- return oSettings;
- };
-
- this.fnUpdate = function () {
- this._fnUpdateClones();
- this._fnUpdatePositions();
- };
-
- this.fnPosition = function () {
- this._fnUpdatePositions();
- };
- var dt = $.fn.dataTable.Api ?
- new $.fn.dataTable.Api( mTable ).settings()[0] :
- mTable.fnSettings();
- dt._oPluginFixedHeader = this;
-
- this.fnInit( dt, oInit );
- };
- FixedHeader.prototype = {
-
-
- fnInit: function ( oDtSettings, oInit )
- {
- var s = this.fnGetSettings();
- var that = this;
-
- this.fnInitSettings( s, oInit );
- if ( oDtSettings.oScroll.sX !== "" || oDtSettings.oScroll.sY !== "" )
- {
- alert( "FixedHeader 2 is not supported with DataTables' scrolling mode at this time" );
- return;
- }
- s.nTable = oDtSettings.nTable;
- oDtSettings.aoDrawCallback.unshift( {
- "fn": function () {
- FixedHeader.fnMeasure();
- that._fnUpdateClones.call(that);
- that._fnUpdatePositions.call(that);
- },
- "sName": "FixedHeader"
- } );
- s.bFooter = ($('>tfoot', s.nTable).length > 0) ? true : false;
-
- if ( s.oSides.top )
- {
- s.aoCache.push( that._fnCloneTable( "fixedHeader", "FixedHeader_Header", that._fnCloneThead ) );
- }
- if ( s.oSides.bottom )
- {
- s.aoCache.push( that._fnCloneTable( "fixedFooter", "FixedHeader_Footer", that._fnCloneTfoot ) );
- }
- if ( s.oSides.left )
- {
- s.aoCache.push( that._fnCloneTable( "fixedLeft", "FixedHeader_Left", that._fnCloneTLeft, s.oSides.left ) );
- }
- if ( s.oSides.right )
- {
- s.aoCache.push( that._fnCloneTable( "fixedRight", "FixedHeader_Right", that._fnCloneTRight, s.oSides.right ) );
- }
-
- FixedHeader.afnScroll.push( function () {
- that._fnUpdatePositions.call(that);
- } );
- $(window).resize( function () {
- FixedHeader.fnMeasure();
- that._fnUpdateClones.call(that);
- that._fnUpdatePositions.call(that);
- } );
- $(s.nTable)
- .on('column-reorder.dt', function () {
- FixedHeader.fnMeasure();
- that._fnUpdateClones( true );
- that._fnUpdatePositions();
- } )
- .on('column-visibility.dt', function () {
- FixedHeader.fnMeasure();
- that._fnUpdateClones( true );
- that._fnUpdatePositions();
- } );
-
- FixedHeader.fnMeasure();
- that._fnUpdateClones();
- that._fnUpdatePositions();
- s.bInitComplete = true;
- },
-
-
- fnInitSettings: function ( s, oInit )
- {
- if ( oInit !== undefined )
- {
- if ( oInit.top !== undefined ) {
- s.oSides.top = oInit.top;
- }
- if ( oInit.bottom !== undefined ) {
- s.oSides.bottom = oInit.bottom;
- }
- if ( typeof oInit.left == 'boolean' ) {
- s.oSides.left = oInit.left ? 1 : 0;
- }
- else if ( oInit.left !== undefined ) {
- s.oSides.left = oInit.left;
- }
- if ( typeof oInit.right == 'boolean' ) {
- s.oSides.right = oInit.right ? 1 : 0;
- }
- else if ( oInit.right !== undefined ) {
- s.oSides.right = oInit.right;
- }
- if ( oInit.zTop !== undefined ) {
- s.oZIndexes.top = oInit.zTop;
- }
- if ( oInit.zBottom !== undefined ) {
- s.oZIndexes.bottom = oInit.zBottom;
- }
- if ( oInit.zLeft !== undefined ) {
- s.oZIndexes.left = oInit.zLeft;
- }
- if ( oInit.zRight !== undefined ) {
- s.oZIndexes.right = oInit.zRight;
- }
- if ( oInit.offsetTop !== undefined ) {
- s.oOffset.top = oInit.offsetTop;
- }
- if ( oInit.alwaysCloneTop !== undefined ) {
- s.oCloneOnDraw.top = oInit.alwaysCloneTop;
- }
- if ( oInit.alwaysCloneBottom !== undefined ) {
- s.oCloneOnDraw.bottom = oInit.alwaysCloneBottom;
- }
- if ( oInit.alwaysCloneLeft !== undefined ) {
- s.oCloneOnDraw.left = oInit.alwaysCloneLeft;
- }
- if ( oInit.alwaysCloneRight !== undefined ) {
- s.oCloneOnDraw.right = oInit.alwaysCloneRight;
- }
- }
- },
-
- _fnCloneTable: function ( sType, sClass, fnClone, iCells )
- {
- var s = this.fnGetSettings();
- var nCTable;
-
- if ( $(s.nTable.parentNode).css('position') != "absolute" )
- {
- s.nTable.parentNode.style.position = "relative";
- }
-
- nCTable = s.nTable.cloneNode( false );
- nCTable.removeAttribute( 'id' );
- var nDiv = document.createElement( 'div' );
- nDiv.style.position = "absolute";
- nDiv.style.top = "0px";
- nDiv.style.left = "0px";
- nDiv.className += " FixedHeader_Cloned "+sType+" "+sClass;
-
- if ( sType == "fixedHeader" )
- {
- nDiv.style.zIndex = s.oZIndexes.top;
- }
- if ( sType == "fixedFooter" )
- {
- nDiv.style.zIndex = s.oZIndexes.bottom;
- }
- if ( sType == "fixedLeft" )
- {
- nDiv.style.zIndex = s.oZIndexes.left;
- }
- else if ( sType == "fixedRight" )
- {
- nDiv.style.zIndex = s.oZIndexes.right;
- }
-
- nCTable.style.margin = "0";
-
- nDiv.appendChild( nCTable );
- document.body.appendChild( nDiv );
- return {
- "nNode": nCTable,
- "nWrapper": nDiv,
- "sType": sType,
- "sPosition": "",
- "sTop": "",
- "sLeft": "",
- "fnClone": fnClone,
- "iCells": iCells
- };
- },
-
- _fnMeasure: function ()
- {
- var
- s = this.fnGetSettings(),
- m = s.oMes,
- jqTable = $(s.nTable),
- oOffset = jqTable.offset(),
- iParentScrollTop = this._fnSumScroll( s.nTable.parentNode, 'scrollTop' ),
- iParentScrollLeft = this._fnSumScroll( s.nTable.parentNode, 'scrollLeft' );
- m.iTableWidth = jqTable.outerWidth();
- m.iTableHeight = jqTable.outerHeight();
- m.iTableLeft = oOffset.left + s.nTable.parentNode.scrollLeft;
- m.iTableTop = oOffset.top + iParentScrollTop;
- m.iTableRight = m.iTableLeft + m.iTableWidth;
- m.iTableRight = FixedHeader.oDoc.iWidth - m.iTableLeft - m.iTableWidth;
- m.iTableBottom = FixedHeader.oDoc.iHeight - m.iTableTop - m.iTableHeight;
- },
-
- _fnSumScroll: function ( n, side )
- {
- var i = n[side];
- while ( n = n.parentNode )
- {
- if ( n.nodeName == 'HTML' || n.nodeName == 'BODY' )
- {
- break;
- }
- i = n[side];
- }
- return i;
- },
-
- _fnUpdatePositions: function ()
- {
- var s = this.fnGetSettings();
- this._fnMeasure();
- for ( var i=0, iLen=s.aoCache.length ; i<iLen ; i++ )
- {
- if ( s.aoCache[i].sType == "fixedHeader" )
- {
- this._fnScrollFixedHeader( s.aoCache[i] );
- }
- else if ( s.aoCache[i].sType == "fixedFooter" )
- {
- this._fnScrollFixedFooter( s.aoCache[i] );
- }
- else if ( s.aoCache[i].sType == "fixedLeft" )
- {
- this._fnScrollHorizontalLeft( s.aoCache[i] );
- }
- else
- {
- this._fnScrollHorizontalRight( s.aoCache[i] );
- }
- }
- },
-
- _fnUpdateClones: function ( full )
- {
- var s = this.fnGetSettings();
- if ( full ) {
-
-
-
- s.bInitComplete = false;
- }
- for ( var i=0, iLen=s.aoCache.length ; i<iLen ; i++ )
- {
- s.aoCache[i].fnClone.call( this, s.aoCache[i] );
- }
- if ( full ) {
- s.bInitComplete = true;
- }
- },
-
-
- _fnScrollHorizontalRight: function ( oCache )
- {
- var
- s = this.fnGetSettings(),
- oMes = s.oMes,
- oWin = FixedHeader.oWin,
- oDoc = FixedHeader.oDoc,
- nTable = oCache.nWrapper,
- iFixedWidth = $(nTable).outerWidth();
- if ( oWin.iScrollRight < oMes.iTableRight )
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft+oMes.iTableWidth-iFixedWidth)+"px", 'left', nTable.style );
- }
- else if ( oMes.iTableLeft < oDoc.iWidth-oWin.iScrollRight-iFixedWidth )
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop-oWin.iScrollTop)+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', (oWin.iWidth-iFixedWidth)+"px", 'left', nTable.style );
- }
- else
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
- }
- },
-
- _fnScrollHorizontalLeft: function ( oCache )
- {
- var
- s = this.fnGetSettings(),
- oMes = s.oMes,
- oWin = FixedHeader.oWin,
- oDoc = FixedHeader.oDoc,
- nTable = oCache.nWrapper,
- iCellWidth = $(nTable).outerWidth();
- if ( oWin.iScrollLeft < oMes.iTableLeft )
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
- }
- else if ( oWin.iScrollLeft < oMes.iTableLeft+oMes.iTableWidth-iCellWidth )
- {
- this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop-oWin.iScrollTop)+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', "0px", 'left', nTable.style );
- }
- else
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft+oMes.iTableWidth-iCellWidth)+"px", 'left', nTable.style );
- }
- },
-
- _fnScrollFixedFooter: function ( oCache )
- {
- var
- s = this.fnGetSettings(),
- oMes = s.oMes,
- oWin = FixedHeader.oWin,
- oDoc = FixedHeader.oDoc,
- nTable = oCache.nWrapper,
- iTheadHeight = $("thead", s.nTable).outerHeight(),
- iCellHeight = $(nTable).outerHeight();
- if ( oWin.iScrollBottom < oMes.iTableBottom )
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+oMes.iTableHeight-iCellHeight)+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
- }
- else if ( oWin.iScrollBottom < oMes.iTableBottom+oMes.iTableHeight-iCellHeight-iTheadHeight )
- {
- this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', (oWin.iHeight-iCellHeight)+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft-oWin.iScrollLeft)+"px", 'left', nTable.style );
- }
- else
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+iCellHeight)+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
- }
- },
-
- _fnScrollFixedHeader: function ( oCache )
- {
- var
- s = this.fnGetSettings(),
- oMes = s.oMes,
- oWin = FixedHeader.oWin,
- oDoc = FixedHeader.oDoc,
- nTable = oCache.nWrapper,
- iTbodyHeight = 0,
- anTbodies = s.nTable.getElementsByTagName('tbody');
- for (var i = 0; i < anTbodies.length; ++i) {
- iTbodyHeight += anTbodies[i].offsetHeight;
- }
- if ( oMes.iTableTop > oWin.iScrollTop + s.oOffset.top )
- {
-
- this._fnUpdateCache( oCache, 'sPosition', "absolute", 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
- }
- else if ( oWin.iScrollTop + s.oOffset.top > oMes.iTableTop+iTbodyHeight )
- {
-
- this._fnUpdateCache( oCache, 'sPosition', "absolute", 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+iTbodyHeight)+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
- }
- else
- {
-
- this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
- this._fnUpdateCache( oCache, 'sTop', s.oOffset.top+"px", 'top', nTable.style );
- this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft-oWin.iScrollLeft)+"px", 'left', nTable.style );
- }
- },
-
- _fnUpdateCache: function ( oCache, sCache, sSet, sProperty, oObj )
- {
- if ( oCache[sCache] != sSet )
- {
- oObj[sProperty] = sSet;
- oCache[sCache] = sSet;
- }
- },
-
- _fnClassUpdate: function ( source, dest )
- {
- var that = this;
- if ( source.nodeName.toUpperCase() === "TR" || source.nodeName.toUpperCase() === "TH" ||
- source.nodeName.toUpperCase() === "TD" || source.nodeName.toUpperCase() === "SPAN" )
- {
- dest.className = source.className;
- }
- $(source).children().each( function (i) {
- that._fnClassUpdate( $(source).children()[i], $(dest).children()[i] );
- } );
- },
-
-
- _fnCloneThead: function ( oCache )
- {
- var s = this.fnGetSettings();
- var nTable = oCache.nNode;
- if ( s.bInitComplete && !s.oCloneOnDraw.top )
- {
- this._fnClassUpdate( $('thead', s.nTable)[0], $('thead', nTable)[0] );
- return;
- }
-
- var iDtWidth = $(s.nTable).outerWidth();
- oCache.nWrapper.style.width = iDtWidth+"px";
- nTable.style.width = iDtWidth+"px";
-
- while ( nTable.childNodes.length > 0 )
- {
- $('thead th', nTable).unbind( 'click' );
- nTable.removeChild( nTable.childNodes[0] );
- }
-
- var nThead = $('thead', s.nTable).clone(true)[0];
- nTable.appendChild( nThead );
-
- var a = [];
- var b = [];
- $("thead>tr th", s.nTable).each( function (i) {
- a.push( $(this).width() );
- } );
- $("thead>tr td", s.nTable).each( function (i) {
- b.push( $(this).width() );
- } );
- $("thead>tr th", s.nTable).each( function (i) {
- $("thead>tr th:eq("+i+")", nTable).width( a[i] );
- $(this).width( a[i] );
- } );
- $("thead>tr td", s.nTable).each( function (i) {
- $("thead>tr td:eq("+i+")", nTable).width( b[i] );
- $(this).width( b[i] );
- } );
-
-
- $('th.sorting, th.sorting_desc, th.sorting_asc', nTable).bind( 'click', function () {
- this.blur();
- } );
- },
-
- _fnCloneTfoot: function ( oCache )
- {
- var s = this.fnGetSettings();
- var nTable = oCache.nNode;
-
- oCache.nWrapper.style.width = $(s.nTable).outerWidth()+"px";
-
- while ( nTable.childNodes.length > 0 )
- {
- nTable.removeChild( nTable.childNodes[0] );
- }
-
- var nTfoot = $('tfoot', s.nTable).clone(true)[0];
- nTable.appendChild( nTfoot );
-
- $("tfoot:eq(0)>tr th", s.nTable).each( function (i) {
- $("tfoot:eq(0)>tr th:eq("+i+")", nTable).width( $(this).width() );
- } );
- $("tfoot:eq(0)>tr td", s.nTable).each( function (i) {
- $("tfoot:eq(0)>tr td:eq("+i+")", nTable).width( $(this).width() );
- } );
- },
-
- _fnCloneTLeft: function ( oCache )
- {
- var s = this.fnGetSettings();
- var nTable = oCache.nNode;
- var nBody = $('tbody', s.nTable)[0];
-
- while ( nTable.childNodes.length > 0 )
- {
- nTable.removeChild( nTable.childNodes[0] );
- }
-
- nTable.appendChild( $("thead", s.nTable).clone(true)[0] );
- nTable.appendChild( $("tbody", s.nTable).clone(true)[0] );
- if ( s.bFooter )
- {
- nTable.appendChild( $("tfoot", s.nTable).clone(true)[0] );
- }
-
- var sSelector = 'gt(' + (oCache.iCells - 1) + ')';
- $('thead tr', nTable).each( function (k) {
- $('th:' + sSelector, this).remove();
- } );
- $('tfoot tr', nTable).each( function (k) {
- $('th:' + sSelector, this).remove();
- } );
- $('tbody tr', nTable).each( function (k) {
- $('td:' + sSelector, this).remove();
- } );
- this.fnEqualiseHeights( 'thead', nBody.parentNode, nTable );
- this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable );
- this.fnEqualiseHeights( 'tfoot', nBody.parentNode, nTable );
- var iWidth = 0;
- for (var i = 0; i < oCache.iCells; i++) {
- iWidth += $('thead tr th:eq(' + i + ')', s.nTable).outerWidth();
- }
- nTable.style.width = iWidth+"px";
- oCache.nWrapper.style.width = iWidth+"px";
- },
-
- _fnCloneTRight: function ( oCache )
- {
- var s = this.fnGetSettings();
- var nBody = $('tbody', s.nTable)[0];
- var nTable = oCache.nNode;
- var iCols = $('tbody tr:eq(0) td', s.nTable).length;
-
- while ( nTable.childNodes.length > 0 )
- {
- nTable.removeChild( nTable.childNodes[0] );
- }
-
- nTable.appendChild( $("thead", s.nTable).clone(true)[0] );
- nTable.appendChild( $("tbody", s.nTable).clone(true)[0] );
- if ( s.bFooter )
- {
- nTable.appendChild( $("tfoot", s.nTable).clone(true)[0] );
- }
- $('thead tr th:lt('+(iCols-oCache.iCells)+')', nTable).remove();
- $('tfoot tr th:lt('+(iCols-oCache.iCells)+')', nTable).remove();
-
- $('tbody tr', nTable).each( function (k) {
- $('td:lt('+(iCols-oCache.iCells)+')', this).remove();
- } );
- this.fnEqualiseHeights( 'thead', nBody.parentNode, nTable );
- this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable );
- this.fnEqualiseHeights( 'tfoot', nBody.parentNode, nTable );
- var iWidth = 0;
- for (var i = 0; i < oCache.iCells; i++) {
- iWidth += $('thead tr th:eq('+(iCols-1-i)+')', s.nTable).outerWidth();
- }
- nTable.style.width = iWidth+"px";
- oCache.nWrapper.style.width = iWidth+"px";
- },
-
- "fnEqualiseHeights": function ( parent, original, clone )
- {
- var that = this;
- var originals = $(parent +' tr', original);
- var height;
- $(parent+' tr', clone).each( function (k) {
- height = originals.eq( k ).css('height');
-
-
-
-
- if ( navigator.appName == 'Microsoft Internet Explorer' ) {
- height = parseInt( height, 10 ) + 1;
- }
- $(this).css( 'height', height );
-
-
-
- originals.eq( k ).css( 'height', height );
- } );
- }
- };
- FixedHeader.oWin = {
- "iScrollTop": 0,
- "iScrollRight": 0,
- "iScrollBottom": 0,
- "iScrollLeft": 0,
- "iHeight": 0,
- "iWidth": 0
- };
- FixedHeader.oDoc = {
- "iHeight": 0,
- "iWidth": 0
- };
- FixedHeader.afnScroll = [];
- FixedHeader.fnMeasure = function ()
- {
- var
- jqWin = $(window),
- jqDoc = $(document),
- oWin = FixedHeader.oWin,
- oDoc = FixedHeader.oDoc;
- oDoc.iHeight = jqDoc.height();
- oDoc.iWidth = jqDoc.width();
- oWin.iHeight = jqWin.height();
- oWin.iWidth = jqWin.width();
- oWin.iScrollTop = jqWin.scrollTop();
- oWin.iScrollLeft = jqWin.scrollLeft();
- oWin.iScrollRight = oDoc.iWidth - oWin.iScrollLeft - oWin.iWidth;
- oWin.iScrollBottom = oDoc.iHeight - oWin.iScrollTop - oWin.iHeight;
- };
- FixedHeader.version = "2.1.2";
- $(window).scroll( function () {
- FixedHeader.fnMeasure();
- for ( var i=0, iLen=FixedHeader.afnScroll.length ; i<iLen ; i++ ) {
- FixedHeader.afnScroll[i]();
- }
- } );
- $.fn.dataTable.FixedHeader = FixedHeader;
- $.fn.DataTable.FixedHeader = FixedHeader;
- return FixedHeader;
- };
- if ( typeof define === 'function' && define.amd ) {
- define( ['jquery', 'datatables'], factory );
- }
- else if ( typeof exports === 'object' ) {
-
- factory( require('jquery'), require('datatables') );
- }
- else if ( jQuery && !jQuery.fn.dataTable.FixedHeader ) {
-
- factory( jQuery, jQuery.fn.dataTable );
- }
- })(window, document);
|