-
12 May 2008 10:09 AM #1
"ExtJS" way to scroll the window
"ExtJS" way to scroll the window
Hi Guys
Is there an "ExtJS" way to scroll the window (the "native" browser window)
In normal JS it would look like:
Code:function getScrollXY() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return [ scrOfX, scrOfY ]; }
Thank you
-
13 May 2008 6:05 AM #2
Hey Guys
I found the answer to my question. Just in case someone else battles with this - it's really easy
Check out Extjs API for Element and also look at the function scrollCode:var body = Ext.get('docBody'); // add id docBody to your HTML ie. <body id="docBody"> // or use DomQuery to get the body tag body.scrollTo('top', 67);
-
13 May 2008 6:27 AM #3
Ext.getBody() return the document body Element.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
15 Nov 2012 5:07 AM #4
Ext is only javascript after-all, so, just call native:
That worked for me.Code:window.scrollTo(0, 0);
did nada.Code:Ext.getBody().scrollTo('top', 0);


Reply With Quote