//DataTable
$('#example').dataTable({
"aoColumns": [
null,
null,
null,
null,
null,
null,
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false },
{ "bVisible": false }
],
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bJQueryUI": true,
"sDom": '<"top"i>rt<"bottom"flp>T<"clear">',
"oTableTools": {
"aButtons": [ "copy", "csv", "xls"],
"sSwfPath": "http://xxxx/copy_csv_xls.swf"
//"sSwfPath": "C:/swf/copy_csv_xls.swf" -->This works when swapping the two lines
}
<?php
$site = $_GET['site'];
if(!$site){exit;}
getcountsbyap($site);
$testq = pg_query("SELECT equipment.description FROM equipment LEFT JOIN basestation ON equipment.equipid=basestation.equipid WHERE basestation.siteid=$site");
function getcountsbyap($site){
$query = pg_query("SELECT name,address[1] as street FROM customers LEFT JOIN customer_custom_fields ON
customers.customerid = customer_custom_fields.customerid WHERE field_id=13 AND
substring(value from 1 for 4) = '$site' AND customerstatus[1]='current'")or die(pg_last_error());
echo pg_num_rows($query);
echo "<table cellpadding=0 cellspacing=0 border=0 class=display id=res1><thead><tr><th>Customer Name</th><th>Address</th><th>Site</th></tr></thead><tbody>";
while($row=pg_fetch_array($query)){
echo "<tr><td>".$row['name'].'</td><td>'.$row['street']."</td><td>".$site."</td></tr>";
}
}
echo "</tbody></table>";
killconnect($conn);
?>
<style type="text/css" title="currentStyle">
@import "../datatables/media/css/demo_page.css";
@import "../datatables/media/css/demo_table.css";
</style>
<script type="text/javascript" language="javascript" src="../datatables/media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../datatables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="../datatables/extras/TableTools/media/js/ZeroClipboard.js"></script>
<script type="text/javascript" charset="utf-8" src="../datatables/extras/TableTools/media/js/TableTools.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready( function () {
$('#res1').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "../datatables/extras/TableTools/media/swf/new.swf"
}
} );
} );
</script>
"aButtons": [
"copy",
{
"sExtends": "pdf",
"sFileName": "ppg.pdf"
},
"print"
]
<div class="tab-pane active" id="tab-general"> <table id="datatable_general" class="table table-bordered table-condensed"> // contents </table> </div>
<div class="tab-pane" id="tab-runs"> <table id="datatable_main" class="table table-bordered table-condensed"> // content </table> </div>In the uppertable, the table tools work, in the other one they don't. When I switch the active class, table tools works for the table at the bottom. When I put the active class at both tables, it works for both (but this messes up the display of the page) and when I totally remove the active class, it doesn't work anymore.
//Initialse DataTables, with no sorting on the 'details' column
var oTableRuns = $('#datatable_main').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "api_query/table_feed",
"sServerMethod": "POST",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "bSearchable": false, "bVisible": false, "aTargets": [ 1, 2 ] },
],
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
"sSwfPath": "SWF/tableTools/copy_csv_xls_pdf.swf",
"aButtons": [
{ // TODO: these buttons don't work anymore.
"sExtends": "collection",
"sButtonText": "Export <span class='caret' />",
"aButtons": ["copy","print","csv", "xls", "pdf"],
},
{
"sExtends": "text",
"sButtonText": "Toggle Results",
"fnClick": function toggleResults(nButton,oConfig,oFlash) {
oTableRunsShowAll = !oTableRunsShowAll;
oTableRuns.fnDraw(true);
},
},
],
},
"aaSorting": [[5, 'desc']],
"aLengthMenu": [[10, 50, 100, 250], [10, 50, 100, 250]],
"iDisplayLength" : 50,
"bAutoWidth": false,
"bPaginate": true,
});
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.