Can you please take a look at This Demo and let me know how I can re-position the dataTabes buttons somewhere else , let say inside .panel-heading
calss and apply btn-sm
to them?
Here is the very basic standard format which I have now
JavaScript
x
8
1
$(document).ready(function() {
2
$('#example').DataTable({
3
responsive: true,
4
dom: 'Bfrtip',
5
buttons: ['copy', 'excel', 'pdf', 'csv']
6
});
7
});
8
and as you are fully aware it is adding the buttons inside #example-wrapper
Advertisement
Answer
Sure. Use jQuery appendTo()
, like this:
JavaScript
1
3
1
//create DataTable first, then...
2
$("#example_wrapper > .dt-buttons").appendTo("div.panel-heading");
3
See this fiddle: https://jsfiddle.net/gz586wpj/1/
There’s also a prependTo()
that you can consider.