Combine Double Initialization of Table - Deep Linking
Combine Double Initialization of Table - Deep Linking
jkalla
Posts: 6Questions: 2Answers: 0
Error messages shown: "...Cannot reinitialize datatable..."
Description of problem: I have two scripts that need to be combined, but I'm not sure how to do it.
$(document).ready( function () {
$('#myTable').DataTable({
language: {
search: "Filter records: "
},
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
bLengthChange:true,
bInfo:true,
bPaginate:true,
order: [[2, "desc"]],
search: {
return: false
}
});
} );
$('#myTable').DataTable( $.fn.dataTable.ext.deepLink( [
'search.search', 'order', 'displayStart'
] ) );
This question has accepted answers - jump to:
Answers
I think you will need to use the Extending defaults example code. Something like this:
Kevin
Thanks, @kthorngren! It didn't work, and I'm not smart enough to troubleshoot. I'll see if I can implement it on this network and post a link.
If you look at the browser's console you will see an error similar to this:
Its a syntax error. The
;
at the end of$.extend( defaultOptions, searchOptions );
shouldn't be there. Just remove the trailing semicolon.The error is in the deeplining docs. @allan will need to remove the semicoln.
Here is a running example of your code:
https://live.datatables.net/lakepinu/1/edit
This shows loading with page 2:
https://live.datatables.net/lakepinu/1?displayStart=10
Kevin
@kthorngren! Thanks! That fixed it for me.
Oops - thanks for flagging that Kevin. I've corrected it in source control now and will deploy the fix soon.
Allan