how I to listen for template or list to scroll top or bottom

I want to how to listen for the template or the list to scroll to the top or bottom.
When the scroll in the end of load the next page of data, scroll at the top to refresh the data.How is this done in dhtmlxTouch?

onAfterScroll event takes an object that contains e (horizontal scroll position) and f (vertical scroll position)

$$(“mylist”).attachEvent(“onAfterScroll”,function(pos){
/your code here/
});

pos.f is 0 if you scrolled to the top and negative value in the other case. To check whether the list is scrolled to the last item you may get the number of scrolled items ( (scroll_position + view_height ) / item_height). If this number is equal the number of loaded items, you may load the next portion of items:

$$("mylist").attachEvent("onAfterScroll",function(pos){ var count = (Math.abs(pos.f)+this.$view.offsetHeight)/43; //43 is item height if(count+0.1>=this.dataCount()) $$("mylist").loadNext(20); });

Tks Alexandra。

Hi,
The 43 (item height) is a standard value or will that change according to my config?.

Hi,

The 43 (item height) is a standard value or will that change according to my config?.

you can set different height in list type:
dhx.ui({
view: “list”,
type:{
height: 60
},…
});