PDA

View Full Version : sync grid scrolling positions



ttbgwt
27 Aug 2012, 1:43 PM
In the bodyScroll event of a grid, I want to copy the scrollTop position of that grid, and set the scrollTop of another grid to the same scrollTop position. I was able to do this in 3.4 but cant figure out in 4.1?



viewConfig: {
listeners: {
bodyScroll: function (event, target) {
otherGrid.setScrollTop(target.scrollTop);
}
}
},


old 3.4 code for grid bodyScroll event:



listeners: {
bodyScroll: function (scrollLeft, scrollTop) {
anotherGrid.getView().scroller.scrollTo('top', scrollTop);
}
}

sword-it
27 Aug 2012, 11:52 PM
HI!

you may try following:-



var scrollPosition = 100;
YourGrid.getEl().down('.x-grid-view').scrollTo('top', scrollPosition, false);