ColVis sAlign=right position issue

ColVis sAlign=right position issue

mr_perplexedmr_perplexed Posts: 3Questions: 0Answers: 0
edited July 2011 in Bug reports
When sAlign=right and ColVis_MasterButton is close to the RH edge of the page, the initial position of ColVis_collection is calculated incorrectly. This is due to an issue in the visual corrections section in _fnCollectionShow:
[code]
/* Visual corrections to try and keep the collection visible */
nHidden.style.left = this.s.sAlign=="left" ?
iDivX+"px" : (iDivX-$(nHidden).outerWidth()+$(this.dom.button).outerWidth())+"px";

var iDivWidth = $(nHidden).outerWidth();
var iDivHeight = $(nHidden).outerHeight();

if ( iDivX + iDivWidth > iDocWidth )
{
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
}
[/code]
If sAlign=right, the first line sets nHidden.style.left to iDivX-$(nHidden).outerWidth()+$(this.dom.button).outerWidth(). A few lines down, we check to see if nHidden (the collection div) is pushed off the right hand side of the page by evaluating the if statement (iDivX + iDivWidth > iDocWidth). This check is based on the assumption that the left position of nHidden is iDivX which is true if sAlign=left but not if sAlign=right.

The check should be based on the actual left position value of nHidden, rather than assuming the left position is iDivX. The fix is quite simple - change the if clause (iDivX + iDivWidth > iDocWidth) to (nHidden.style.left + iDivWidth > iDocWidth):
[code]
/* Visual corrections to try and keep the collection visible */
nHidden.style.left = this.s.sAlign=="left" ?
iDivX+"px" : (iDivX-$(nHidden).outerWidth()+$(this.dom.button).outerWidth())+"px";

var iDivWidth = $(nHidden).outerWidth();
var iDivHeight = $(nHidden).outerHeight();

// Fix applied here - change iDivX to nHidden.style.left
if ( nHidden.style.left + iDivWidth > iDocWidth )
{
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
}
[/code]
This discussion has been closed.