Pagination

Pagination

jcrawfordjcrawford Posts: 172Questions: 0Answers: 0
edited May 2010 in General
Hello,

Is there anything that I need to do manually to get pagination to work? I thought it happened by default but the pagination controls are not showing in my UI.

Here is page 1 of my data.

[code]
{
"iTotalRecords": 74093,
"iTotalDisplayRecords": 74093,
"aaData": [
[
"2929",
"es-ES",
"Amkert ES",
"Amkert",
"Zanox",
"Yes",
"0",
""
],
[
"3007",
"es-ES",
"AutoEurope ES",
"AutoEurope Spain",
"Tradedoubler",
"Yes",
"0",
""
],
[
"2961",
"es-ES",
"Late Rooms ES",
"Late Rooms",
"Zanox",
"Yes",
"0",
""
],
[
"3295",
"es-ES",
"Brussels Airlines ES",
"brusselsairlines",
"Zanox",
"Yes",
"0",
""
],
[
"3039",
"es-ES",
"Jazztel ES",
"CJM_Jazztel ES (venta)",
"Commission Junction",
"Yes",
"0",
""
],
[
"2993",
"es-ES",
"Expedia ES",
"Expedia",
"Tradedoubler",
"Yes",
"0",
""
],
[
"3327",
"es-ES",
"neumaticos ES",
"neumaticos-online",
"Zanox",
"Yes",
"0",
""
],
[
"2938",
"es-ES",
"PhoneHouse ES",
"PhoneHouse ES",
"Zanox",
"Yes",
"0",
""
],
[
"3016",
"es-ES",
"InterHome SRL ES",
"InterHome SRL",
"Tradedoubler",
"Yes",
"0",
""
],
[
"2970",
"es-ES",
"Zed Spain ES",
"Zed Spain",
"Zanox",
"Yes",
"0",
""
]
]
}
[/code]

Replies

  • jcrawfordjcrawford Posts: 172Questions: 0Answers: 0
    *bump*
  • jcrawfordjcrawford Posts: 172Questions: 0Answers: 0
    *bump*
  • codingavenuecodingavenue Posts: 22Questions: 0Answers: 0
    Hi,

    Could you post your DataTables initialization code?

    codingavenue
  • jcrawfordjcrawford Posts: 172Questions: 0Answers: 0
    Hello,

    Note that i have tried adding bPagination: true and that did not help
    could there be a bug in the latest version or am I the only one experiencing this?

    Below is my initialization code:

    [code]
    $(document).ready(
    function() {
    $("#MerchantTable").dataTable(
    {
    "aaSorting": [[ 2, "asc" ]],
    "fnRowCallback": function( nRow, aData, iDisplayIndex ) {
    nRow.className = aData[5]=="Yes" ? nRow.className : "disabled_row";
    return nRow;
    },
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "/merchants/tabledata/",
    "bAutoWidth": true,
    "aoColumns": [
    { "bSearchable": false, "bSortable": false },
    { "bSearchable": true, "bSortable": true },
    { "bSearchable": true, "bSortable": true },
    { "bSearchable": true, "bSortable": true },
    { "bSearchable": true, "bSortable": true },
    { "bSearchable": true, "bSortable": true, "bVisible": false },
    { "bSearchable": true, "bSortable": true },
    { "bSearchable": true, "bSortable": true }
    ]
    }
    );
    }
    );
    [/code]
  • jcrawfordjcrawford Posts: 172Questions: 0Answers: 0
    I could not get this to work until I added this to my initialization code


    "sPaginationType": "full_numbers",
  • bicatubicatu Posts: 2Questions: 0Answers: 0
    Hello, in my case not event with this option I can make it work.

    My ajax call returns (the aaData colapsed)

    aaData: [[,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…], [,…],…]
    iTotalDisplayRecords: 1050
    iTotalRecords: 1050
    sEcho: 0

    But only the first page is rendered (it only shows the number 1 - plus the next/previous)

    $('#list').dataTable({
    "bProcessing" : true,
    "bServerSide" : false,
    "bInfo": true,
    "sPaginationType": "full_numbers",
    "iDisplayLength" : 25,
    "sAjaxSource" : url ,
    ...
  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    This is a really old thread - it would be best to open a new one in future I think :-)

    > sEcho: 0

    sEcho should never be 0. See http://datatables.net/usage/server-side

    Allan
This discussion has been closed.