Reinitialise DataTable error

Reinitialise DataTable error

samir_gamblersamir_gambler Posts: 5Questions: 0Answers: 0
edited December 2013 in DataTables 1.9
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

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    > table-editable.js

    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
  • samir_gamblersamir_gambler Posts: 5Questions: 0Answers: 0
    I am using 'table-editable.js' to edit the content being displayed in the table. I am unable to combine the initialize happening twice. Either edit link stops working or content are not loaded in the table.
    Thanks,
    Samir
This discussion has been closed.