Patch DataTables ColVis to fix dropdown extending past bottom of page
This commit is contained in:
@@ -71,7 +71,7 @@ ul.ColVis_collection {
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
padding: 8px 8px 4px 8px;
|
padding: 8px 8px 4px 8px;
|
||||||
margin: 10px 0px 0px 0px;
|
margin: 10px 0px 10px 0px;
|
||||||
background-color: #444;
|
background-color: #444;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: 2002;
|
z-index: 2002;
|
||||||
|
@@ -790,6 +790,9 @@ ColVis.prototype = {
|
|||||||
oStyle.top = oPos.top+"px";
|
oStyle.top = oPos.top+"px";
|
||||||
oStyle.left = iDivX+"px";
|
oStyle.left = iDivX+"px";
|
||||||
|
|
||||||
|
var iDocWidth = $(document).width();
|
||||||
|
var iDocHeight = $(document).height();
|
||||||
|
|
||||||
document.body.appendChild( nBackground );
|
document.body.appendChild( nBackground );
|
||||||
document.body.appendChild( nHidden );
|
document.body.appendChild( nHidden );
|
||||||
document.body.appendChild( this.dom.catcher );
|
document.body.appendChild( this.dom.catcher );
|
||||||
@@ -819,12 +822,17 @@ ColVis.prototype = {
|
|||||||
|
|
||||||
var iDivWidth = $(nHidden).outerWidth();
|
var iDivWidth = $(nHidden).outerWidth();
|
||||||
var iDivHeight = $(nHidden).outerHeight();
|
var iDivHeight = $(nHidden).outerHeight();
|
||||||
var iDocWidth = $(document).width();
|
var iDivMarginTop = parseInt($(nHidden).css("marginTop"), 10);
|
||||||
|
var iDivMarginBottom = parseInt($(nHidden).css("marginBottom"), 10);
|
||||||
|
|
||||||
if ( iLeft + iDivWidth > iDocWidth )
|
if ( iLeft + iDivWidth > iDocWidth )
|
||||||
{
|
{
|
||||||
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
|
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
|
||||||
}
|
}
|
||||||
|
if ( iDivY + iDivHeight > iDocHeight )
|
||||||
|
{
|
||||||
|
nHidden.style.top = (oPos.top - iDivHeight - iDivMarginTop - iDivMarginBottom)+"px";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.s.hidden = false;
|
this.s.hidden = false;
|
||||||
@@ -846,7 +854,8 @@ ColVis.prototype = {
|
|||||||
this.s.hidden = true;
|
this.s.hidden = true;
|
||||||
|
|
||||||
$(this.dom.collection).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
$(this.dom.collection).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
||||||
this.style.display = "none";
|
// this.style.display = "none";
|
||||||
|
document.body.removeChild( this );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$(this.dom.background).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
$(this.dom.background).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
||||||
|
Reference in New Issue
Block a user