I am trying to combine 2 JavaScript code blocks in in my footer but when I use both it gives an error. How do I combine 2 JavaScript code blocks?
FIRST
$(document).ready(function() {
$('#mydata').DataTable( {
"order": [[ 0, "desc" ]],
scrollY: 400,
scrollCollapse: true,
paging: true
} );
} );
SECOND
$(document).ready(function() {
$('#mydata').DataTable( {
"oLanguage": {
"sUrl": "js/dil/English.json",
}
} );
} );
Error message: DataTables warning: table id=mydata - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
They are just JavaScript initialisation objects. Just combine the objects:
$(document).ready(function() {
$('#mydata').DataTable({
"order": [
[0, "desc"]
],
scrollY: 400,
scrollCollapse: true,
paging: true,
"oLanguage": {
"sUrl": "js/dil/English.json",
}
});
});
This should be working. You need to clearly tell what's the error coming up.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.