Reload datatable when changing dtOptions
See original GitHub issueIn my context, I have a search form. When you submit this form, the client will send an ajax request to retrieve result rows. Once this rows are client-side, I create a datatable and I’m playing around with the rows inside fnServerData.
Basically I have something like this:
self.searchButtonClick = function() {
myService.getData(myCriteria).then(function(rows) {
self.dtColumnDefs = [ ... ];
self.dtOptions = DTOptionsBuilder.newOptions()
.withOption('fnServerData', function (sSource, aoData, fnCallback) {
// Do some work with rows and aoData
fnCallBack(json);
});
}
}
The first search works great. When I submit a second time, I retrieve well the result rows from the server, but rewrite dtOptions is not enough to update the datatable content.
I would like to erase and recreate the datatable each time the user submit the form.
I tried to do it using this link but I don’t understand it well.
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
How to reload table with new data? — DataTables forums
I should point out that I am using this as test code before I try to implement a table reload function with user...
Read more >How to refresh jquery data table in Angular 6 after event ...
I'm going to delete country and call rerender function but datatable not refreshed. angular · datatable · Share.
Read more >Angular 7 | How to Detect Changes And Re-Render DataTables
In this video tutorial, we will lear the process to re-render Datatable after the new product is added to the Database. We will...
Read more >Angular 12 Refresh Reload Datatable on Button Click ...
Today in this blog post, I am going to show you, Angular 12 Refresh Reload Datatable on Button Click Functionality. Guy's for adding...
Read more >jQuery Datatables | Reloading data after filter values are ...
Suppose there are two filters on the screen: Date from Date to We need to reload data of Jquery datatable based on changed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The API
reloadData
andrerender
are from theDTInstance
. For example:Thanks, it works!
Final code: