All pastes #942740 Raw Edit

||cw

public text v1 · immutable
·published 2008-03-14 18:47 UTC
rendered paste body
this.singleSelectDataTable.subscribe("rowSelectEvent",  RowSelected);
.
.
.

function RowSelected(parm)
{
	ShowME();
	elScroll = parm.el.parentNode.parentNode.parentNode;
	goTop = elScroll.scrollTop; //default to not moving
	goTopLimit = (elScroll.offsetHeight + elScroll.scrollTop - (parm.el.offsetHeight * 3));
	goBottomLimit = (elScroll.scrollTop + (parm.el.offsetHeight * 2));
	
	if (parm.el.offsetTop > goTopLimit)  //below visible area
	{
		goTop = parm.el.offsetTop - elScroll.offsetHeight + (parm.el.offsetHeight * 3);
	}
	else if(parm.el.offsetTop < goBottomLimit)  //above visible area
	{
		goTop = parm.el.offsetTop - (parm.el.offsetHeight * 2);;
	}
	
	if (goTop < 0) goTop = 0;
	if (!(goTop == elScroll.scrollTop) && (goTop < goTopLimit || goTop > goBottomLimit))  //don't bother animating if we don't need to
	{
		var anim = new YAHOO.util.Scroll(elScroll, { scroll: { to: [0, goTop], totalFrames: 2 } });
		anim.animate();	
	}
}