datatables.net-fixedcolumns
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -1,3 +0,3 @@ | ||
/*! FixedColumns 3.2.0 | ||
* ©2010-2014 SpryMedia Ltd - datatables.net/license | ||
/*! FixedColumns 3.2.1 | ||
* ©2010-2016 SpryMedia Ltd - datatables.net/license | ||
*/ | ||
@@ -8,7 +8,7 @@ | ||
* @description Freeze columns in place on a scrolling DataTable | ||
* @version 3.2.0 | ||
* @version 3.2.1 | ||
* @file dataTables.fixedColumns.js | ||
* @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
* @contact www.sprymedia.co.uk/contact | ||
* @copyright Copyright 2010-2014 SpryMedia Ltd. | ||
* @copyright Copyright 2010-2016 SpryMedia Ltd. | ||
* | ||
@@ -52,4 +52,4 @@ * This source file is free software, available under the following license: | ||
var DataTable = $.fn.dataTable; | ||
var _firefoxScroll; | ||
/** | ||
@@ -495,7 +495,20 @@ * When making use of DataTables' x-axis scrolling feature, you may wish to | ||
var mouseController; | ||
var mouseDown = false; | ||
// When the mouse is down (drag scroll) the mouse controller cannot | ||
// change, as the browser keeps the original element as the scrolling one | ||
$(this.s.dt.nTableWrapper).on( 'mousedown.DTFC', function () { | ||
mouseDown = true; | ||
$(document).one( 'mouseup', function () { | ||
mouseDown = false; | ||
} ); | ||
} ); | ||
// When the body is scrolled - scroll the left and right columns | ||
$(this.dom.scroller) | ||
.on( 'mouseover.DTFC touchstart.DTFC', function () { | ||
mouseController = 'main'; | ||
if ( ! mouseDown ) { | ||
mouseController = 'main'; | ||
} | ||
} ) | ||
@@ -525,3 +538,5 @@ .on( 'scroll.DTFC', function (e) { | ||
.on( 'mouseover.DTFC touchstart.DTFC', function () { | ||
mouseController = 'left'; | ||
if ( ! mouseDown ) { | ||
mouseController = 'left'; | ||
} | ||
} ) | ||
@@ -553,3 +568,5 @@ .on( 'scroll.DTFC', function ( e ) { | ||
.on( 'mouseover.DTFC touchstart.DTFC', function () { | ||
mouseController = 'right'; | ||
if ( ! mouseDown ) { | ||
mouseController = 'right'; | ||
} | ||
} ) | ||
@@ -586,2 +603,3 @@ .on( 'scroll.DTFC', function ( e ) { | ||
.on( 'draw.dt.DTFC', function () { | ||
that._fnColCalc(); | ||
that._fnDraw.call( that, bFirstDraw ); | ||
@@ -601,12 +619,16 @@ bFirstDraw = false; | ||
} ) | ||
.on( 'select.dt.DTFC deselect.dt.DTFC', function ( e, dt, type, indexes ) { | ||
that._fnDraw( false ); | ||
} ) | ||
.on( 'destroy.dt.DTFC', function () { | ||
jqTable.off( 'column-sizing.dt.DTFC column-visibility.dt.DTFC destroy.dt.DTFC draw.dt.DTFC' ); | ||
jqTable.off( '.DTFC' ); | ||
$(that.dom.scroller).off( 'mouseover.DTFC touchstart.DTFC scroll.DTFC' ); | ||
$(window).off( 'resize.DTFC' ); | ||
$(that.dom.scroller).off( '.DTFC' ); | ||
$(window).off( '.DTFC' ); | ||
$(this.s.dt.nTableWrapper).off( '.DTFC' ); | ||
$(that.dom.grid.left.liner).off( 'mouseover.DTFC touchstart.DTFC scroll.DTFC '+wheelType ); | ||
$(that.dom.grid.left.liner).off( '.DTFC '+wheelType ); | ||
$(that.dom.grid.left.wrapper).remove(); | ||
$(that.dom.grid.right.liner).off( 'mouseover.DTFC touchstart.DTFC scroll.DTFC '+wheelType ); | ||
$(that.dom.grid.right.liner).off( '.DTFC '+wheelType ); | ||
$(that.dom.grid.right.wrapper).remove(); | ||
@@ -713,3 +735,3 @@ } ); | ||
'</div>'+ | ||
'<div class="DTFC_RightWrapper" style="position:absolute; top:0; left:0;">'+ | ||
'<div class="DTFC_RightWrapper" style="position:absolute; top:0; right:0;">'+ | ||
'<div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0;">'+ | ||
@@ -751,2 +773,4 @@ '<div class="DTFC_RightHeadBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div>'+ | ||
nRight.style.right = oOverflow.bar+"px"; | ||
block = $('div.DTFC_RightHeadBlocker', nSWrapper)[0]; | ||
@@ -777,2 +801,20 @@ block.style.width = oOverflow.bar+"px"; | ||
} | ||
// RTL support - swap the position of the left and right columns (#48) | ||
if ( $(this.dom.body).css('direction') === 'rtl' ) { | ||
$(nLeft).css( { | ||
left: '', | ||
right: 0 | ||
} ); | ||
$(nRight).css( { | ||
left: oOverflow.bar+"px", | ||
right: '' | ||
} ); | ||
$('div.DTFC_RightHeadBlocker', nSWrapper).css( { | ||
left: -oOverflow.bar+'px', | ||
right: '' | ||
} ); | ||
} | ||
}, | ||
@@ -788,2 +830,3 @@ | ||
{ | ||
var that = this; | ||
var oGrid = this.dom.grid; | ||
@@ -805,2 +848,8 @@ var iWidth = $(oGrid.wrapper).width(); | ||
} | ||
else if ( that._firefoxScrollError() ) { | ||
// See the above function for why this is required | ||
if ( $(node).height() > 34 ) { | ||
node.style.width = (width+oOverflow.bar)+"px"; | ||
} | ||
} | ||
else { | ||
@@ -842,3 +891,2 @@ // Otherwise just overflow by the scrollbar | ||
oGrid.right.wrapper.style.width = iRightWidth+"px"; | ||
oGrid.right.wrapper.style.left = iRight+"px"; | ||
oGrid.right.wrapper.style.height = "1px"; | ||
@@ -1151,4 +1199,2 @@ oGrid.right.body.style.height = iBodyHeight+"px"; | ||
$('>tbody>tr', that.dom.body).each( function (z) { | ||
var n = this.cloneNode(false); | ||
n.removeAttribute('id'); | ||
var i = that.s.dt.oFeatures.bServerSide===false ? | ||
@@ -1158,2 +1204,6 @@ that.s.dt.aiDisplay[ that.s.dt._iDisplayStart+z ] : z; | ||
var n = this.cloneNode(false); | ||
n.removeAttribute('id'); | ||
n.setAttribute( 'data-dt-row', i ); | ||
for ( iIndex=0 ; iIndex<aiColumns.length ; iIndex++ ) | ||
@@ -1166,2 +1216,4 @@ { | ||
nClone = $( aTds[iColumn] ).clone(true, true)[0]; | ||
nClone.setAttribute( 'data-dt-row', i ); | ||
nClone.setAttribute( 'data-dt-column', iIndex ); | ||
n.appendChild( nClone ); | ||
@@ -1333,2 +1385,37 @@ } | ||
} | ||
}, | ||
/** | ||
* Determine if the UA suffers from Firefox's overflow:scroll scrollbars | ||
* not being shown bug. | ||
* | ||
* Firefox doesn't draw scrollbars, even if it is told to using | ||
* overflow:scroll, if the div is less than 34px height. See bugs 292284 and | ||
* 781885. Using UA detection here since this is particularly hard to detect | ||
* using objects - its a straight up rendering error in Firefox. | ||
* | ||
* @return {boolean} True if Firefox error is present, false otherwise | ||
*/ | ||
_firefoxScrollError: function () { | ||
if ( _firefoxScroll === undefined ) { | ||
var test = $('<div/>') | ||
.css( { | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
height: 10, | ||
width: 50, | ||
overflow: 'scroll' | ||
} ) | ||
.appendTo( 'body' ); | ||
// Make sure this doesn't apply on Macs with 0 width scrollbars | ||
_firefoxScroll = ( | ||
test[0].clientWidth === test[0].offsetWidth && this._fnDTOverflow().bar !== 0 | ||
); | ||
test.remove(); | ||
} | ||
return _firefoxScroll; | ||
} | ||
@@ -1431,3 +1518,3 @@ } ); | ||
*/ | ||
FixedColumns.version = "3.2.0"; | ||
FixedColumns.version = "3.2.1"; | ||
@@ -1434,0 +1521,0 @@ |
{ | ||
"name": "datatables.net-fixedcolumns", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "FixedColumns for DataTables ", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48257
1385