Problem with disappearing 'counter' for the row number when using pagination

Problem with disappearing 'counter' for the row number when using pagination

tomzolltomzoll Posts: 7Questions: 0Answers: 0
edited December 2012 in General
Hello. I've got a problem with disappearing "counter" for the row number. When i click "next or previous" button in pagination, my row counter disappearings. Here is my live example: http://kartoteka.tbop.org.pl/v3/test/dt/examples/server_side/row_details.html . And here info from debugger: http://debug.datatables.net/epesag


This is my js file:
[code]

$(document).ready(function() {

oTable = $('#example').dataTable( {
"fnDrawCallback": function ( oSettings ) {
var that = this;
/* Need to redo the counters if filtered or sorted */
if ( oSettings.bSorted || oSettings.bFiltered )
{
this.$('td:first-child', {"filter":"applied"}).each( function (i) {
that.fnUpdate( i+1, this.parentNode, 0, false, false );
} );
}
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/details_col.php",
"aoColumns": [
{ "sClass": "center", "bSortable": false },
null,
null,
null,
{ "sClass": "center" },
{ "sClass": "center" }
],
"aaSorting": [[1, 'asc']]
} );
} );

[/code]

This is a part of my php file responsible for the output:
[code]
/*
* Output
*/
$output = array(
"sEcho" => intval($_GET['sEcho']),
"iTotalRecords" => $iTotal,
"iTotalDisplayRecords" => $iFilteredTotal,
"aaData" => array()
);

while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();

/* Add the details image at the start of the display array */
$row[]='';

for ( $i=0 ; $i

Replies

  • katakpisangkatakpisang Posts: 1Questions: 0Answers: 0
    I faced the same problem before and I did like the code below. I'm not sure whether the method is right or not but it works for me.

    js:
    [code]

    $(document).ready(function() {

    oTable = $('#example').dataTable( {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "scripts/details_col.php"

    } );
    } );

    [/code]

    php:
    [code]
    $aColumns = array( 'id', 'engine', 'browser', 'platform', 'version', 'grade' );

    ....
    ....
    ....

    /*
    * Output
    */
    $output = array(
    "sEcho" => intval($_GET['sEcho']),
    "iTotalRecords" => $iTotal,
    "iTotalDisplayRecords" => $iFilteredTotal,
    "aaData" => array()
    );

    $n=1;

    while ( $aRow = mysql_fetch_array( $rResult ) )
    {
    $row = array();

    for ( $i=0 ; $i
  • tomzolltomzoll Posts: 7Questions: 0Answers: 0
    thanks, i'll try your solution:)
  • rnavarro70rnavarro70 Posts: 1Questions: 0Answers: 0
    $row[] = $n + $_GET['isDisplayStart'];
    Work! A million thanks. I'm not coding in PHP but in C# and the logic was the same.
This discussion has been closed.