How to get the records for the second page with server side processing

How to get the records for the second page with server side processing

SigalSigal Posts: 8Questions: 1Answers: 0

Hi,

I am sorry if there is an answer for this already, but I am searching for hours with no success.

I am using serverside processing, I don't understand how do I get the records from my MySql database for the second page with the 'iDisplayStart' parameter.

The records I get for the second page are the same as the ones I get on the first page.

If I limit the records, in my sql query like so: select * from table limit 10 offset 10, the first time the page loads
the second page button does not appear (because of course, I fetched only 10 records).

As far as I know I can't do an offset on a table without a limit, so I am very confused here.

Can someone please help me with that?

Answers

  • SigalSigal Posts: 8Questions: 1Answers: 0

    I tried using the Draw parameter, but I am not getting any Draw parameter from the client side. Tried to set it to the value I'm getting from 'iDisplayStart', didn't help.

  • SigalSigal Posts: 8Questions: 1Answers: 0

    I see another problem now:

    When I load the page, under the table I see:
    Showing 1 to 10 of 11 entries

    But the table has 11 entries in it and not 10.

  • SigalSigal Posts: 8Questions: 1Answers: 0

    I tried to hard code the values returned like this:

     $json = array(
                'sEcho'=>$s_echo,
                'iDisplayStart'=>$offset,
                "iTotalRecords" => 11,
                "iTotalDisplayRecords" => 10,
                "aaData" => $invoices
            );
    

    Bottom Line: Showing 1 to 10 of 10 entries (filtered from 11 total entries)

    Rows in first page of the table: 11 (not 10)

This discussion has been closed.