Expose Scroll Event?
Expose Scroll Event?
joshuasiegal
Posts: 19Questions: 2Answers: 1
I've seen some threads (urls below) on Scroller, infinite Scrolling, etc., and I've checked out the Scroller and dataTables source, and one thing I'm not getting is why you would have scrolling, infinite scrolling, and an Extra for scrolling, but then swallow the scroll event on .dataTables_scrollBody for people to hook into. You do expose the ability for people to explicitly bind to other events through your api:
[code]
$(document).ready(function() {
$('#example')
.bind('sort', function () { eventFired( 'Sort' ); })
.bind('filter', function () { eventFired( 'Filter' ); })
.bind('page', function () { eventFired( 'Page' ); })
.dataTable();
} );
[/code]
Why isn't scroll on the list? One example I'm trying to use is to only load images in rows when they are in the scroll view, to save user bandwidth. This is not possible without binding to the scroll event, as far as I know.
If there is a solution that I'm missing somewhere, or I'm just wrong in my understanding of this, then I apologize.
Thanks!
[code]
$(document).ready(function() {
$('#example')
.bind('sort', function () { eventFired( 'Sort' ); })
.bind('filter', function () { eventFired( 'Filter' ); })
.bind('page', function () { eventFired( 'Page' ); })
.dataTable();
} );
[/code]
Why isn't scroll on the list? One example I'm trying to use is to only load images in rows when they are in the scroll view, to save user bandwidth. This is not possible without binding to the scroll event, as far as I know.
If there is a solution that I'm missing somewhere, or I'm just wrong in my understanding of this, then I apologize.
Thanks!
This discussion has been closed.
Replies
[code]
$('div.dataTables_scrollBody').scroll( ... );
[/code]
No need for a custom callback - which is why it is not exposed.
Allan
http://datatables.net/forums/discussion/11191/datatables-scroller-debouncing-scroll-events-and-requestanimationframe/p1
http://datatables.net/release-datatables/examples/advanced_init/dt_events.html
But since you are the expert, I tried it again.
And it works. Clearly, you are some sort of magician. *thanks!*
[code]
$('#datatable_wrapper').on('scroll','.dataTables_scrollBody',function() {...
[/code]
If you have any insight as to why that failed, i'd be interested to know. Thanks again.
Allan