admin管理员组文章数量:1432152
I'm using dataTable plugin to show data from Database , The table looks like:
name location actions
jack New York Edit , Delete
john London Edit , Delete
... ... Edit , Delete
The Adding/Editing/Deleting functions are working well , But I have to refresh the page to see the results.
How to reload the table but keep the previous parameters like page and searching if they exist?
I'm using dataTable plugin to show data from Database , The table looks like:
name location actions
jack New York Edit , Delete
john London Edit , Delete
... ... Edit , Delete
The Adding/Editing/Deleting functions are working well , But I have to refresh the page to see the results.
How to reload the table but keep the previous parameters like page and searching if they exist?
Share Improve this question asked Mar 9, 2018 at 22:10 jackjack 1512 silver badges12 bronze badges2 Answers
Reset to default 3You can use:
table.ajax.reload(null, false);
The second parameter is resetPaging, if is true will reset the datatable to default, if is false will hold the current paging position. The first parameter is a callback function.
For more information, see: https://datatables/reference/api/ajax.reload()
If using and XHR data source with DataTables:
// Init DataTables with XHR source
var table = $('#myTable').DataTable({
ajax: "my/xhr/data/source"
});
// Reload the table every 30 seconds
setInterval( function () {
table.ajax.reload();
}, 30000);
Of course, you could reload under a refresh button on after you add/edit/delete rows in your XHR callbacks.
本文标签:
版权声明:本文标题:javascript - How to reload datatable keeping the page and filtering searching if exist without refreshing the page? - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745589469a2665111.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论