datatables and Tabletools

datatables and Tabletools

msabmsab Posts: 3Questions: 0Answers: 0
edited November 2011 in TableTools
So I am trying to get Tabletools working with datatables. The code stops working when I add in the TableTools to the document.ready section.

Here is my code. I would appreciate if someone can look at it and see if anything is done incorrect in the header section or body. My data tables code reneders properly when pull out the Tabletools lines in the document.ready section.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">



Device CMDB

@import "../dataTables-1.8.2/media/css/demo_page.css";
@import "../dataTables-1.8.2/media/css/demo_table.css";
@import "../TableTools-2.0.1/media/css/TableTools.css";











$(document).ready(function() {
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "../TableTools-2.0.1/media/swf/copy_cvs_xls_pdf.swf"
},
"bPaginate": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 75,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false
}
);
} );





Device Management CMDB

List of all Network services devices


<?php
// connect to the database
include('connect-db.php');
// get results from database
$result = mysql_query("SELECT * FROM devices")
or die(mysql_error());

// display data in table
echo "View All | ";
echo "Add a device";
//echo "";
echo "";
echo "
IP
Customer
Hostname
Location
Region
Netcool
Solarwinds
InfoVista
DeviceType
Arch
Status
DateAdded
Edit
Delete
";
echo "";
// loop through results of database query, displaying them in the table
$gradeColor = "gradeC";
while ($row = mysql_fetch_array($result)) {
// echo out the contents of each row into a table
echo "";
echo '' . $row['IP'] . '';
echo '' . $row['Customer'] . '';
echo '' . $row['Hostname'] . '';
echo '' . $row['Location'] . '';
echo '' . $row['Region'] . '';
echo '' . $row['Netcool'] . '';
echo '' . $row['Solarwinds'] . '';
echo '' . $row['Infovista'] . '';
echo '' . $row['DeviceType'] . '';
echo '' . $row['Arch'] . '';
echo '' . $row['Status'] . '';
echo '' . $row['DateAdded'] . '';
echo 'Edit';
// echo 'Delete';
echo 'Delete';
echo "";
}

// close table>
echo "
IP
Customer
Hostname
Location
Region
Netcool
Solarwinds
InfoVista
DeviceType
Arch
Status
DateAdded
";
echo "";
?>

Replies

  • msabmsab Posts: 3Questions: 0Answers: 0
    commenting out these lines makes the code work again
    //"sDom": 'T<"clear">lfrtip',
    //"oTableTools": {
    // "sSwfPath": "../TableTools-2.0.1/media/swf/copy_cvs_xls_pdf.swf"
    // },
This discussion has been closed.