Hi everyone,
What I want is simple but I can't make it work. I have an Ext.List with 5 items in it. When I scroll to the end of that list, it load 5 more items and so on. After loading these new items, I want to scroll down to these news items.
I tried the next code but it does not work. The alert return 0.
But then, when I scroll the list again (not even to the end) it scrolls to these news items.
Code:
this.actuGrid = new Ext.List({
store: app.stores.actualites,
grouped : false,
itemTpl: app.templates.actualiteList,
listeners: {
scroller: {
scrollend: function(scroller, offset){
var currentNumberOfNews = parseInt(app.stores.actualites.getCount());
var nextNumberOfNews = currentNumberOfNews+app.newsPerLoad;
var newYPosition = currentNumberOfNews*70;
app.stores.actualites.load(
new Ext.data.Operation({
start:0,
limit:nextNumberOfNews
})
);
scroller.scrollTo({x:0,y:newYPosition});
alert(offset.y);
}
}
}
});
I hope somebody can tell me what is wrong with the code or what the problem is.
Thank you