View Full Version : Find scrollbar position on scroll grid

28 Jun 2012, 7:50 AM
Hi, I am trying to get an event to fire when I scroll on my grid component. I wish to know how much is left before it hits the bottom of the scrollbar. I have been trying to look how to do this with no prevail. I feel there is probably an easier way than what I am doing. Appreciate any help

28 Jun 2012, 11:24 AM
The following should work:



16 Dec 2012, 6:50 AM
Hm ... not really, as this gives me the distance (in pixels???) from the top point of the view.
Nevertheless, I need an information / event in the case that the scrollbar hits the bottom end of the view.

Any clues here?



16 Dec 2012, 10:53 PM
Does the following snippet help?

Ext.create('Ext.container.Container', {
height: 140,
width: 400,
autoScroll: true,
renderTo: Ext.getBody(),
html: 'a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>a<br>'
, listeners: {
boxready: function (ct) {
ct.el.on('scroll', function () {
var threshold = ct.el.dom.scrollHeight - ct.el.getScroll().top - ct.el.getHeight();
var met = threshold > 100 ? 'greater than 100' : 'less than 100';
console.log(met + ' (' + threshold + ')');

16 Dec 2012, 11:28 PM
Thanks a lot for the snippet. It works (technically), but it doesnt't deliver the right infromation. It says '100' at approx 90% scroll distance...

Nevertheless, I'll try to develop on the snippet and see if I can get it to do what I need :)

Thanks again