next button does not work when using pagination

next button does not work when using pagination

james_littlejames_little Posts: 3Questions: 0Answers: 0
edited May 2013 in DataTables 1.9
hello everyone, i have a problem on using dataTables 1.9 and i need you guys help me with this.

i set the pagination style to "full numbers", the [next] button does not work when i use pagination,
but the [Previous] button and page number button works perfectly.

anyone know what the reason for this.
thank you!

javascript :
[code]
$(document).ready(function() {
$('#example').dataTable({
"bPaginate": true,
"sPaginationType": "full_numbers",
"bFilter": true,
"bSort": true,
"bInfo": false,
"bJQueryUI": true,
"bLengthChange": true,
"sScrollX": "50%",
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": ".../supporttool/new_queue/query_ajax",
"fnServerParams": function ( aoData ) {
var app_id = $('#app_id').val();
var request_start_date = $('#request_start_date').val();
var request_end_date = $('#request_end_date').val();
if(app_id){
aoData.push( {"name": "app_id","value": app_id});
}
if(request_start_date){
aoData.push( {"name": "request_start_date","value": request_start_date});
}
if(request_end_date){
aoData.push( {"name": "request_end_date","value": request_end_date});
}
},
"bDeferRender": true,
"bAutoWidth": true
});
} );
[/code]

the response json is like:
[code]
{
"sEcho":2,
"iTotalRecords":"5683",
"iDisplayLength":10,
"aaData":[
...
]
}
[/code]

Replies

  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Your JSON response looks incorrect - see http://datatables.net/usage/server-side

    In particular:

    > iTotalRecords - Total records, before filtering (i.e. the total number of records in the database)

    > iTotalDisplayRecords - Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned in this result set)

    (iDisplayLength is irrelevant and you haven't got iTotalDisplayRecords).

    Allan
  • james_littlejames_little Posts: 3Questions: 0Answers: 0
    [quote]
    Your JSON response looks incorrect - see http://datatables.net/usage/server-side

    In particular:

    iTotalRecords - Total records, before filtering (i.e. the total number of records in the database)

    iTotalDisplayRecords - Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned in this result set)

    (iDisplayLength is irrelevant and you haven't got iTotalDisplayRecords).

    Allan
    [/quote]

    Thank you very much!

    Which data is used by dataTables to judge if a next/previous button is needed or not?

    For some reason i also want to trigger a ajax request from some elements created by myself.
    i.e. i create my own filtering field and put a search button beside it, when i click the search button,
    i want dataTables send a request to server and fill data with data rows.
    Can i do this and how can I do this?

    Thank you very much!
  • james_littlejames_little Posts: 3Questions: 0Answers: 0
    [quote]
    For some reason i also want to trigger a ajax request from some elements created by myself.
    i.e. i create my own filtering field and put a search button beside it, when i click the search
    button, i want dataTables send a request to server and fill data with data rows.
    [/quote]

    i got answer myself...
    make dataTable a global variable, call fnDraw() when the search button is click.
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    > Which data is used by dataTables to judge if a next/previous button is needed or not?

    Primarily it uses iTotalDisplayRecords to determine paging actions. Which is why its not working for you, since you aren't returning that parameter :-).

    And yes, fnDraw is correct!

    Allan
This discussion has been closed.