PDA

View Full Version : How to fire a scroll event for a container



url
26 Nov 2012, 11:38 PM
Hi All,
In my app i have a window in which i place a container as an item and based on the number of records in the store am keep on adding the containers to it. But due to huge data there is performance issue. Now i want to show an alert message when the scroll bar is 100px up from the end of the container.



Can anybody help how can i achieve this one?

mitchellsimoens
28 Nov 2012, 12:19 PM
The element being scrolled should fire a scroll event.

slemmon
28 Nov 2012, 2:39 PM
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 + ')');
});
}
}
});