Using scroller without knowing the total number of records

Using scroller without knowing the total number of records

tomasofttomasoft Posts: 1Questions: 1Answers: 0

Hello everyone!,
I am trying to accomplish the infinite scroll functionality with the new scroller.

I am working on an MVC project using Server side proccessing with Ajax to populate Datatables.
My question is the following...
Given that we do not have the total number of records for the returned data, can we somehow make scroller ask for more data until there isn't any more to display?
Ideally i would like every time we scroll, Datatables to fire the LoadMoreData method inside our controller and append the data until that method does not return any data so we then set a flag, etc.

I have found solutions with the previous version of Datatables (1.9) but i would like to benefit from the new version if possible.

Thanks everyone in advance for your time!

Answers

  • allanallan Posts: 61,985Questions: 1Answers: 10,162 Site admin

    Unfortunately there is no way to do that with DataTables 1.10 at the moment. Indeed, even with the old versions, any implementation you found to do it was a hack - DataTables has never supported not knowing how many rows there are in the table I'm afraid.

    Indeed, with Scroller (if that is what you are referring to by "scroller") it fundamentally needs to know how many rows there are in the table - otherwise it can't set the scroll height.

    Allan

This discussion has been closed.