由于dataview的分页插件中加载更多按钮会显示在上面,只能放弃使用分页插件,改成了滚动到底部自动刷新,下面这就是在网上找到的监听滚动事件:
1.这是在控制器里的:
config: { refs: { list: '...', ... }, control: { list: { initialize: 'onListInit' }, ... }, ...},onListInit: function(thisCOMP) { var scroller = thisCOMP.getScrollable().getScroller(); scroller.on('scrollstart', this.onNnListScrollStart, this); scroller.on('scrollend', this.onNnListScrollEnd, this);},onNnListScrollStart: function(scroller, x, y) { console.log('START SCROLL');},onNnListScrollEnd: function(scroller, x, y) { console.log('scroll x:'+x); console.log('scroll y:'+y); var bottom = scroller.maxPosition.y; var top = scroller.minPosition.y; var isScrollUp = scroller.dragDirection.y === -1; var isScrollDown = scroller.dragDirection.y === 1; if (bottom === y && isScrollDown) { console.log('BOTTOM'); } if (top === y && isScrollUp) { console.log('TOP'); } console.log('END SCROLL');},...
来源:http://stackoverflow.com/questions/18762768/how-to-get-scroll-at-bottom-and-scroll-at-top-of-a-list-view-of-a-sencha-tou
2.这是在视图里的:
{ xtype:'dataview', fullscreen: true, scrollable: { direction:'vertical', scroller: { listeners:{ scroll:function(){ console.log('[scrollable][on scroll]'); }, scrollend:function( scroller, x, y, eOpts ){ console.log('[scrollable][on scrollend]x='+x+', y='+y); } } } }, store: { fields: ['name', 'age'], data: [ {name: 'Jamie', age: 100}, {name: 'Rob', age: 21}, {name: 'Tommy', age: 24}, {name: 'Jacky', age: 24}, {name: 'Ed', age: 26} ] }, itemTpl: '{name} is {age} years old'}
来源:http://stackoverflow.com/questions/18871581/scroller-events-dont-fire-in-sencha-touch