I want to add a “refresh” button to my tables at the bottom of the table. But I just started using datatables and its a bit confusing as is the “sDom” part where it says I can do this through that means but the description is vague at best.
"sDom": '<"top"i>rt<"bottom"flp><"clear">'
is the datatables.net example, but I dunno how to make heads or tails of that and all I want to do is one simple thing.
Or is there an outside of “sDom” that would be better suited for what I want to do?
Here’s a live example of a modified
sDom.http://live.datatables.net/onaqul/edit#javascript,html,live
Here we’re injecting a
divcalled<div id="refresh"></div>with the structrue<"#refresh">.If you inspect the generated dom in the example,
you can see
<div id="refresh"></div>got inserted inside of<div class="bottom"></div>.I think much depends on (1) how your specific table has its footer elements layed out, (2) where you decide to inject your specific element using sDom, and (3) how you style the element(s) with your
CSS.Alternatively, you could have a button created outside of the datatables environment, but use jquery to append or prepend your button to one of the dom elements datatables creates.
Hope this is a useful starting point.