How to get the infiniteScroll behaviour in version 1.10?

How to get the infiniteScroll behaviour in version 1.10?

akhil123akhil123 Posts: 4Questions: 2Answers: 0

function scrollalert(){
var div_of_table = $('.dataTables_scrollBody')[0];
var scrolledTop = div_of_table.scrollTop;
var scrolledHeight = div_of_table.scrollHeight;
var windowHeight = div_of_table.clientHeight;
var earlyLoadOffset = 10;
if(scrolledTop >= (scrolledHeight - (windowHeight + earlyLoadOffset)))
{
** Here I can make the ajax call because the scroll is going to reach the bottom just now. But how to make that ajx request and
append the rows to the existing table?**
}
setTimeout('scrollalert();', 1500);
}

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Sorry - infinite scrolling was removed in DataTables 1.10 - see the upgrade document.

    Allan

  • akhil123akhil123 Posts: 4Questions: 2Answers: 0

    Hi Allan,
    I have read the forum previously about the removal of infinite scroll. But my problem is, I am making Ajax query to get the data from server. The scroller example I saw https://datatables.net/extensions/scroller/examples/initialisation/server-side_processing.html is not using URLs in ajax request, but using the for-loop to generate the data.
    Please help me out to use scroller with an Ajax container URL as ajax source.

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin
    Answer ✓

    If you wanted to use Scroller with server-side processing, you would just set the ajax option to point to the server-side processing script (i.e. a URL).

    The example uses a function rather than a URL allowing it to generate the data locally.

    If you have server-side processing working without Scroller, then it will also work with Scroller.

    Allan

  • akhil123akhil123 Posts: 4Questions: 2Answers: 0

    Thnaks for your quick support Allan.
    It just worked flawlessly.
    You just saved my day. Thanks. :)

This discussion has been closed.