I have view in codeigniter which I am trying to enhance with datatables and the TableTools extension. I am using version 1.94 of datatables. According to R shiny dataTables with TableTools and other extensions, version 2.1.5 of table tools is needed. I have included this. I am trying to follow http://datatables.net/extensions/tabletools/ and the article above to get TableTools working, but so far there is no sign of the TableTools toolbar. What am I doing wrong?
Here's my code:
<table id="myDataTable">
<thead>
<tr>
<th>ROW</th>
<?php foreach($keys as $key): ?>
<th><?php echo $key; ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php $i=1; foreach($fulltable as $row): ?>
<tr id="<?php echo $i ?>">
<td><?php echo $i; ?></td>
<?php foreach($row as $cell): ?>
<td><?php echo $cell; ?></td>
<?php endforeach; ?>
</tr>
<?php $i++; endforeach; ?>
</tbody>
</table>
<!--jQuery-->
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<!--DataTables CSS-->
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<!--DataTables-->
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<!--DataTable tools-->
<script type="text/javascript" charset="utf8" src='//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/js/TableTools.min.js'></script>
<script type="text/javascript" charset="utf8" src='//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/js/ZeroClipboard.min.js'></script>
<link rel="stylesheet" type="text/css" href='//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/css/TableTools.min.css'>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#myDataTable').dataTable( {
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/swf/copy_csv_xls.swf",
}
});
});
</script>