Reinitialise DataTable error
Reinitialise DataTable error
samir_gambler
Posts: 5Questions: 0Answers: 0
Hello,
I am using DataTable to display details in table form. I am using server side processing to populate table with data and has below function in the page.
[code]
$(document).ready(function() {
$('#sample_editable_1').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "includes/merchant_processing.php"
} );
App.init();
TableEditable.init();
} );
[/code]
I am using 'table-editable.js' file to add the feature of inline editing. In that file there is again initialization of dataTable
[code]
var oTable = $('#sample_editable_1').dataTable({
"aLengthMenu": [
[5, 15, 20, -1],
[5, 15, 20, "All"] // change per page values here
],
// set the initial value
"iDisplayLength": 5,
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records",
"oPaginate": {
"sPrevious": "Prev",
"sNext": "Next"
}
},
"aoColumnDefs": [{
'bSortable': false,
'aTargets': [0]
}
]
});
[/code]
Due to this I am getting error
[code]
DataTables warning (table id = 'sample_editable_1'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy
[/code]
Please guide me how to avoid this error.
Thanks,
Samir
I am using DataTable to display details in table form. I am using server side processing to populate table with data and has below function in the page.
[code]
$(document).ready(function() {
$('#sample_editable_1').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "includes/merchant_processing.php"
} );
App.init();
TableEditable.init();
} );
[/code]
I am using 'table-editable.js' file to add the feature of inline editing. In that file there is again initialization of dataTable
[code]
var oTable = $('#sample_editable_1').dataTable({
"aLengthMenu": [
[5, 15, 20, -1],
[5, 15, 20, "All"] // change per page values here
],
// set the initial value
"iDisplayLength": 5,
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records",
"oPaginate": {
"sPrevious": "Prev",
"sNext": "Next"
}
},
"aoColumnDefs": [{
'bSortable': false,
'aTargets': [0]
}
]
});
[/code]
Due to this I am getting error
[code]
DataTables warning (table id = 'sample_editable_1'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy
[/code]
Please guide me how to avoid this error.
Thanks,
Samir
This discussion has been closed.
Replies
I don't know what that file is I'm afraid. Can you point me at it.
It sounds like the table is being initialised twice. You can't do that. You need to combine the two initialisations into a single one.
Allan
Thanks,
Samir