4
votes

I followed these instruction: http://datatables.net/release-datatables/examples/server_side/server_side.html But I don't get the pagination (nor in bJQuery mode nor classic). Everything is working fine (search, ordering, ...) but I can't get the pagination.

Is there something I'm missing ?

Here the code:

$(document).ready(function() {
    $('#datatable').dataTable( {
                bJQueryUI : true,
        "bProcessing": true,
        "bServerSide": true,
                sPaginationType: "full_numbers",
        "sAjaxSource": "/returnjson"
    } );
} );

Thank you!

Edit: I wrap my parameters in quotation marks. Thanks. dgw, this is changing nothing. That I want is that the paging buttons interact with my serverside code:

/* 
* Paging
*/
$sLimit = " LIMIT 100";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
    $sLimit = " LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
        mysql_real_escape_string( $_GET['iDisplayLength'] );
}

Thanks for your help

Edit 2: I tried with both datatables/demo_table.css and datatables/demo_table_jui.css but this change nothing.

Thanks again !

2
Make sure you wrap your parameter names in quotation marks. "bJQueryUI" and "sPaginationType"Greg Pettit

2 Answers

3
votes

My iTotalDisplayRecords was not set correctly (Total records, after filtering). Source: http://datatables.net/usage/server-side

1
votes

Specify for example

"sDom": '<"top"i>rt<"bottom"flp><"clear">'

within your call to dataTable. This should show the pagination.

For more information have a look at the parameter reference of datatables especially the part about sDom.