Pagination Not Appearing in Table
Pagination Not Appearing in Table
lexiss
Posts: 3Questions: 0Answers: 0
Hi, sorry if this have been addressed.
I have managed to make the basic function working in my table (a table that display row by row data from MySQL database), the search and filter is working fine but one thing that troubling me is that the default pagination button does not appear at the bottom of my tables. I wonder why. Here's my coding,
[code]
<?php
include_once('includes/header.php');
include_once('includes/connect.php');
?>
@import "css/demo_page.css";
@import "css/demo_table.css";
$(document).ready( function() {
$('#test').dataTable( {
"iDisplayLength": 50
} );
} )
IRRADIATING APPARATUS LISTING
<!-- Functional Buttons -->
<!-- Table Header -->
APPARATUS BRAND
MODEL
DETAILS
<?php
$query = "SELECT id, brand, model FROM ir_apparatus ORDER BY brand, model ASC" ;
$result = @mysql_query($query);
// Print result
$bg="even gradeC";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$bg = ($bg=='odd GradeA' ? 'even gradeC' : 'odd GradeA'); // switch background color
echo "
$row[brand]
$row[model]
view
" ;
}
?>
[/code]
I have tried my very best to ensure my coding has met the requirement (proper table tagging, initialization to use DataTable) but still cant find what's my mistake is. Any helps will be appreciated, thanks!!
I have managed to make the basic function working in my table (a table that display row by row data from MySQL database), the search and filter is working fine but one thing that troubling me is that the default pagination button does not appear at the bottom of my tables. I wonder why. Here's my coding,
[code]
<?php
include_once('includes/header.php');
include_once('includes/connect.php');
?>
@import "css/demo_page.css";
@import "css/demo_table.css";
$(document).ready( function() {
$('#test').dataTable( {
"iDisplayLength": 50
} );
} )
IRRADIATING APPARATUS LISTING
<!-- Functional Buttons -->
<!-- Table Header -->
APPARATUS BRAND
MODEL
DETAILS
<?php
$query = "SELECT id, brand, model FROM ir_apparatus ORDER BY brand, model ASC" ;
$result = @mysql_query($query);
// Print result
$bg="even gradeC";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$bg = ($bg=='odd GradeA' ? 'even gradeC' : 'odd GradeA'); // switch background color
echo "
$row[brand]
$row[model]
view
" ;
}
?>
[/code]
I have tried my very best to ensure my coding has met the requirement (proper table tagging, initialization to use DataTable) but still cant find what's my mistake is. Any helps will be appreciated, thanks!!
This discussion has been closed.
Replies
[CODE]
$(document).ready(function() {
$('#leavetp_table').dataTable( {
"bJQueryUI": true,
"bPaginate": true,
'sPaginationType': 'full_numbers',
"bProcessing": true,
"bServerSide": true,
"aaSorting": [[ 1, "desc" ]],
"bAutoWidth": false,
"aoColumns" : [
{ sWidth: '42px' },
{ sWidth: '253px' },
{ sWidth: '100px' },
{ sWidth: '80px' },
{ sWidth: '80px' },
{ sWidth: '76px' }
],
"sAjaxSource": "server-side url name goes here",
} );
} );
jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 10;
[/CODE]
In the server-side function--
return these variables -->> sEcho, iTotalRecords, iTotalDisplayRecords, iDisplayLength, aaData
I have my code in Python.
If you are interested I can post my code.
HTH.
-- Vineet
Allan