PDA

View Full Version : How to get the scrollbar position relative to page in Grid



kshaikh
3 Dec 2009, 5:29 AM
Hi All
My requirment is to show a tooltip at scroll position when we scroll the mouse on grid (Buffered View).

For this I have created obj

var myToolTip = new Ext.ToolTip({

target: gridPanel.getView()'
html: 'Test ToolTip'
});
newToolTip.showAt([box.x+temp.width-10 ,box.y+scrollTop]);

//On Body scroll I am calling a function update tooltip which should be positioned //verticle scrollbar position.

gridPanel.on('bodyscroll',updateToolTip);

var updateToolTip = function(scrollLeft, scrollTop ) {

// This gives the offset of viewport.
var viewportOffset = gridPanel.getView().scroller.dom.viewportOffset();

newToolTip.showA([viewportOffset[0] ,( scrollTop+ viewportOffset[1])]);
}
The Initial positioning of tooltip is at proper position, but as I scroll down the tooltip moves down and go away out of page.

Please if you have any idea of it let me know,