ow the total number of pages in the background code?

ow the total number of pages in the background code?

fandong90fandong90 Posts: 1Questions: 0Answers: 0

hello, i hava a question ,i use DataTable ,it works very good ,but i have encounted a question.when my database was the largest. The front desk will load very slowly. Data I don't want to a pass, only a total number of data, and the current page of data, each click on the page and go back to request data. What should I do.

Replies

  • glendersonglenderson Posts: 231Questions: 11Answers: 29

    How are you writing your SQL statement to count and limit the number of records? When using server side processing, you should be able to obtain the starting record and page length through the idisplaystart and idisplaylength values in the URL.

    To Get all Records Count
    - Select count(*) from yourTable

    To Get the total records matching the search filter
    - Select count(*) from yourTable where [build your search condition]

    To Get the records for display
    - Select count(*) from yourTable where [build your search condition] limit idisplaystart, idisplaylength

    Of course, these sql statements are only general ideas and which database you're using determines the syntax for the starting record and the number of records.

This discussion has been closed.