Server-Side-Processing and pagination

Server-Side-Processing and pagination

SteinweberSteinweber Posts: 1Questions: 0Answers: 0

I have a lot of time needed. But I have found the problem with the pagination on server side.
The solution can be found in the footer. A simple example:
124 rows total in database
iDisplayStart: 0
iDisplayLength: 10
This shows the first 10 of 124 rows
"Showing 1 to 10 of 124 entries"

SQL query is always " LIMIT $_GET[iDisplayStart],$_GET[iDisplayLength]
This returns 10 rows
$total = all rows (124)

Reply from the server:
iTotalRecords => $total,
iTotalDisplayRecords => $total
aaData => 10 rows (not all 124)

so u have a working pagination with 13 pages.

if iTotalRecords > iTotalDisplayRecords:
Once the displayed value is less than the total value, it is assumed that only x rows of 124 are applicable.

if u have a WHERE col = searchField, so u need a SQL_CALC_FOUND.
And if you are using ORDER BY in a table over 5.000 entrys, it's better to make a new query, because the speed is around 4 times faster.

Then
iTotalRecords => $total,
iTotalDisplayRecords => SQL_CALC_FOUND
aaData => 10 rows (not all 124)

I hope I have explained it properly and simply

This discussion has been closed.