Show 10 records on load in datatable from SQL DB but page link should be based on total row count.

Show 10 records on load in datatable from SQL DB but page link should be based on total row count.

vikas bhatvikas bhat Posts: 2Questions: 1Answers: 0
edited January 2022 in DataTables 1.10

Hi Team,

I have 10000 of rows coming from DB but i have to show only 10 rows on page load in Jquery datatable.
But it should have page link spread over to total records coming from DB( eg up to 10000).
I mean page link should be like 1,2,3...…up to total records.
When user click on any page number it should give 10 records based on that page link and so on.

Jquery datatable should also show "Showing 1 to 10 of 10000 entries"

How to achieve it? Can someone pls help me with the code snippet would be grateful?

Thanks
Vikas

Answers

  • kthorngrenkthorngren Posts: 21,324Questions: 26Answers: 4,949
    edited January 2022

    Use server side processing. You can find some examples here and the ssp.class.php script used in the examples.

    Kevin

  • vikas bhatvikas bhat Posts: 2Questions: 1Answers: 0

    I am working on MVC (cshtml) with Jquery and backend controller class. So need suggestion based on this tech stack.
    Also want to highlight again that I only need to fetch 10 records each time from database and when user hit page number it should fetch next 10 records based on that page number.

  • kthorngrenkthorngren Posts: 21,324Questions: 26Answers: 4,949

    I don't believe Datatables provides a server side script example for MVC. You might be able to find some threads like this to help build the server side component to support the server side protocol.

    Kevin

Sign In or Register to comment.