[1.7.2 ver] Pagination not work
[1.7.2 ver] Pagination not work
paky
Posts: 106Questions: 0Answers: 0
Hi Allan, I use last release (1.7.2) my table is server-side
[code]
dataTableEventi=$('#tab_eventi').dataTable
({
"bAutoWidth": false,
"sDom": '<"add_button_eventi">flrtip',
"aoColumns":
[
/*field1*/ {"bVisible":false},
/*field2*/ {"sWidth": "3%","bSortable":true},
/*field3*/ {"sWidth": "10%","bSortable":true},
/*field4*/ {"sWidth": "10%","bSortable":true},
/*field5*/ {"sWidth": "10%","bSortable":false},
/*field6*/ {"sWidth": "20%","bSortable":true},
/*field7*/ {"sWidth": "20%","bSortable":false},
/*field8*/ {"sWidth": "27%","bSortable": false}
],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "__files/eventi/server_processing_table_eventi.php",
// Aggiunta della variabile di sessione
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "session_id", "value": <?php echo $_SESSION['user_id'];?> });
aoData.push( { "name": "rnd", "value": rnd_cache_damn });
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
//salva nei cookies le scelte
"bStateSave": true,
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"oLanguage":
{
"sLengthMenu": "Mostra _MENU_ righe per pagina",
"sZeroRecords": "Nessun evento",
"sSearch":"Trova evento",
"sInfo": "Dal _START_^ al _END_^ su un totale di _TOTAL_ eventi",
"sInfoEmtpy": "0 to 0 of 0 prodotti",
"sInfoFiltered": "( su _MAX_ totali)"
},
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull )
{
$(nRow).addClass(aData[0]);
return nRow;
}
});
[/code]
.... pagination number are dead ... nothing happens if I click on "Next" or "Last" button :( why ?
thanks for all.
[code]
dataTableEventi=$('#tab_eventi').dataTable
({
"bAutoWidth": false,
"sDom": '<"add_button_eventi">flrtip',
"aoColumns":
[
/*field1*/ {"bVisible":false},
/*field2*/ {"sWidth": "3%","bSortable":true},
/*field3*/ {"sWidth": "10%","bSortable":true},
/*field4*/ {"sWidth": "10%","bSortable":true},
/*field5*/ {"sWidth": "10%","bSortable":false},
/*field6*/ {"sWidth": "20%","bSortable":true},
/*field7*/ {"sWidth": "20%","bSortable":false},
/*field8*/ {"sWidth": "27%","bSortable": false}
],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "__files/eventi/server_processing_table_eventi.php",
// Aggiunta della variabile di sessione
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "session_id", "value": <?php echo $_SESSION['user_id'];?> });
aoData.push( { "name": "rnd", "value": rnd_cache_damn });
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
//salva nei cookies le scelte
"bStateSave": true,
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"oLanguage":
{
"sLengthMenu": "Mostra _MENU_ righe per pagina",
"sZeroRecords": "Nessun evento",
"sSearch":"Trova evento",
"sInfo": "Dal _START_^ al _END_^ su un totale di _TOTAL_ eventi",
"sInfoEmtpy": "0 to 0 of 0 prodotti",
"sInfoFiltered": "( su _MAX_ totali)"
},
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull )
{
$(nRow).addClass(aData[0]);
return nRow;
}
});
[/code]
.... pagination number are dead ... nothing happens if I click on "Next" or "Last" button :( why ?
thanks for all.
This discussion has been closed.
Replies
Allan
[from 1 to 10 on total of 10] Total=11
But don't move it on second page for show 11^ record ...
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)
With 11 rows to be display and no filter applied, they should both be 11.
Allan
[code]
{
"sEcho": 1,
"iTotalRecords": 11,
"iTotalDisplayRecords": 10,
"aaData": [
[
"scaduto",
"201",
"28/04/2010",
"03/05/2010",
"06",
"Equipaggio ...",
"divisione spese",
"elimina"
],
[
"scaduto",
"206",
"21/03/2010",
"21/03/2010",
"01",
"Cerchiamo u...",
"gratis",
"elimina"
],
[
"scaduto",
"244",
"20/06/2010",
"20/06/2010",
"01",
"velaggiata ...",
"gratis",
"elimina"
],
[
"incorso",
"253",
"13/08/2010",
"03/11/2010",
"24",
"Ospitiamo p...",
"cambusa costo fisso",
"elimina"
],
[
"",
"264",
"28/09/2010",
"30/09/2010",
"03",
"YOAHOOOO...",
"cambusa costo fisso",
"elimina"
],
[
"",
"265",
"28/09/2010",
"30/09/2010",
"03",
"YOAHOOOO...",
"cambusa costo fisso",
"elimina"
],
[
"",
"266",
"28/09/2010",
"30/09/2010",
"03",
"YOAHOOOO...",
"cambusa costo fisso",
"elimina"
],
[
"",
"267",
"28/09/2010",
"30/09/2010",
"03",
"YOAHOOOO2...",
"cambusa costo fisso",
"elimina"
],
[
"",
"268",
"28/09/2010",
"30/09/2010",
"03",
"YOAH3...",
"camsa fisso",
"elimina"
],
[
"",
"270",
"28/09/2010",
"30/09/2010",
"03",
"YOAH5...",
"camsa fisso",
"elimina"
]
]
}
[/code]
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)
You don't need to tell it the length of the aaData array, since DataTables can just do aaData.length... :-)
Allan
That there is some bug in dataTable 1.7.2 ? The code is always the same one used in an earlier version ...
bye
Can you post a link to an example which isn't working please.
Did you correct the issue with iTotalDisplayRecords (i.e. it should be 11 if there are 11 records in the data set with no filtering and no pagination)?
Allan
Did you correct the issue with iTotalDisplayRecords (i.e. it should be 11 if there are 11 records in the data set with no filtering and no pagination)?
How can correct it ?
Have a look at the json reply in my example server-side processing (link above) and see what is expected.
Allan
[code]
<?php
//MySQL connection
$gaSql['user'] = "";
$gaSql['password'] = "";
$gaSql['db'] = "";
$gaSql['server'] = "localhost";
$gaSql['type'] = "mysql";
$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );
mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );
$sess_id=$_GET['session_id'];
/* Paging */
$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}
/* Ordering */
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $iAvanzamento_Evento()).'",';
$sOutput .= '"'.addslashes($aRow['eve_id']).'",';
$sOutput .= '"'.addslashes(date("d/m/Y",strtotime($aRow['eve_data_start']))).'",';
$sOutput .= '"'.addslashes(date("d/m/Y",strtotime($aRow['eve_data_end']))).'",';
$sOutput .= '"'.addslashes($my_ev->Durata_Evento()).'",';
$sOutput .= '"'.addslashes($descriz_accorc).'",';
$sOutput .= '"'.addslashes($aRow['tce_desc']).'",';
$sOutput .= '"'.addslashes('elimina').'"';
//
aggiungi itinerario
/*
if ( $aRow['version'] == "0" )
$sOutput .= '"-",';
else
$sOutput .= '"'.addslashes($aRow['version']).'",';
$sOutput .= '"'.addslashes($aRow['grade']).'"';
*/
$sOutput .= "],";
}
$sOutput = substr_replace( $sOutput, "", -1 );
$sOutput .= '] }';
echo $sOutput;
function fnColumnToField( $i )
{
if ( $i == 0 )
return 'eve_id';
else if ( $i == 1 )
return 'eve_data_start';
else if ( $i == 2 )
return "eve_data_end";
/*else if ( $i == 3 )
return "version";
else if ( $i == 4 )
return "grade";
*/
}
?>
[/code]
Allan
thanks