react class ajax warning 300 DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise
react class ajax warning 300 DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise
Link to test case:
Debugger code (debug.datatables.net): class Table extends Component {
//cdn.datatables.net/plug-ins/1.11.5/i18n
componentDidMount() {
console.log(this.el)
this.$el = $(this.el)
this.$el.DataTable({
ajax: 'http://127.0.0.1:5000/api/data',
serverSide: true,
columns: [
{title:'Name',data: 'Name'},
{title:'Heating Area',data: 'Heat_area'},
{title:'Primary Supply Temperature',data: 'P_T_S'},
{title:'Primary Return Temperature',data: 'P_T_R',},
{title:'Time11',data: 'timestamps', orderable: false}
],
});};
render() {
return (
);
}
}
Error messages shown: DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
Description of problem: looks like call two times ajax.
Answers
Have you followed the troubleshooting steps provided in the link?
http://datatables.net/tn/3
Maybe your
componentDidMount()
function is called more than once. If that is exepcted then you might need to yourdestroy()
if you are planning to rebuild the Datatable.We will need to see the problem in order to help debug. Please post a link to your page or a test case replicating the issues so we can take a look.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin