Adding button to table footer
Adding button to table footer

Hi,
I've been looking through examples and other questions that seem similar and I'm still having some trouble getting this right. I have some basic code which you can see below. At first I'm just making my DataTable object and I later add the data dynamically which works the way I want it to. My problem is when I try to use "sDom" when I create my DataTables to add a button to the footer. The button can pretty much go anywhere in the footer. I'm required to use DataTables 1.9.4 so I can't upgrade even if I wanted to
html:
<table id="myTable" class="display" border=0 cellspacing="0px" width="100%">
<thead>
<tr>
<th>Category</th>
</tr>
</thead>
</table>
jquery:
var table = $("#myTable").DataTable({
"bJQueryUI" = true
});
I tried adding an "sDom" but with no luck. I'd like to have something like this somewhere in the footer
<div id="myNewDiv">
<button id="myNewButton">Test</button>
</div>
Answers
Assuming that by "footer" you don't mean the table's tfoot element, this is how to add your own HTML using "dom" settings:
http://datatables.net/release-datatables/examples/advanced_init/dom_toolbar.html
This works for version 1.9?
You would need to use the legacy sDom option, but yes that is quite possible in the legacy version.
Allan