How to add a Refresh Tab button
How to add a Refresh Tab button
Please describe exactly how to add a button that'll only refresh the current tab.
Ideally the Buttons plugin would offer a built-in Refresh button but it does not. We fetch data with "ajax": {"url":"getmyajax.foo"} so hopefully the process of adding a button that reloads it, and the tab itself, is moderately straightforward. Thanks :-)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Try this out.
When you say tab it's better if you're more exact. If you're referencing browser tab, this will do it.
Good point. We separate our data tables into several tabs, so it's a button that refreshes a data table.
I just now stumbled upon this so ended up with the following custom refresh button and it seems to work, I'm still testing and reading, but:
Philip,
If you're just looking to refresh the data in the table then your code above will take care of that for you.
I would personally store the Datatable and just reference that.
var myTable = $('#ClientData').DataTable( {
and then call it like this.
myTable.ajax.reload( null, false );
@philip - Yup - that piece of code looks spot on. Just a simple call to
ajax.reload()
.Allan
Hello... It's my solution, to criate a new button instance:
And use the same as the default buttons