Infinite scroll with Scroller

Infinite scroll with Scroller

rogercberogercbe Posts: 3Questions: 2Answers: 0
edited November 2015 in Free community support

I want to implement a table that loads data when user reaches the end of the screen (table) to do so I'm using scroller together with server side ajax functionality, right now it loads all the data at once, and since it's quite a lot of data (thousands of records) it takes too much time. How could I load data the same way paginate works but with a scroll?

Those are my settings:

var table = $('#mytable').DataTable({
        order: [[ 1, "asc" ]],
        paging: false,
        processing: true,
        serverSide: true,
        pageLength: 20,
        responsive: true,
        ajax: '/some/api'
    });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    paging: false,

    Remove that option. With paging disabled it will always load all of the records! That's why it is running to slow - its as if you didn't have server-side processing at all, so all it is doing is adding latency :-)

    Allan

  • rogercberogercbe Posts: 3Questions: 2Answers: 0

    Thank you, after playing around I kind of found that out myself, I created a function to increase the page size everytime the user reaches the end of the screen, apparently it works just fine.

    Again, thanks for the fast answer!

This discussion has been closed.