Uncaught TypeError: api.init is not a function
Uncaught TypeError: api.init is not a function
Having trouble understanding what the issue is. I have tried using both a capital "D" and lowercase "d" for the datatables declaration and am still getting the same error.
In Chrome's debugger I am seeing the following error: Uncaught TypeError: api.init is not a function
This is where the error is (dataTables.buttons.js):
// DataTables dom
feature option
DataTable.ext.feature.push( {
fnInit: function( settings ) {
var api = new DataTable.Api( settings );
var opts = api.init().buttons;
return new Buttons( api, opts ).container();
},
cFeature: "B"
} );
I have updated both my version of jQuery and DataTables to latest versions to ensure that there were not any compatibility issues.
Here is a sample from the javascript (just FYI this is an ASP.Net MVC 5 application):
$(document).ready(function () {
dTable = $('#dataAnalysis').dataTable({
bPaginate: true,
bServerSide: true,
iDisplayLength: 25,
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
bProcessing: true,
scrollX: true,
scrollY: "600px",
scrollCollapse: true,
bAutoWidth: true,
sServerMethod: "POST",
fnServerParams: function( aoData ){
aoData.push({"name": "contractorName", "value": $('#contractorName').val()});
aoData.push({ "name": "service", "value": $('#service').val() });
},
sAjaxSource: "ServiceInstanceDrillDown",
dom: 'Blfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
aoColumns: [
{
"title": "CONTRACT",
"data": "CONTRACT"
... lots more columns follow and probably are not relevant
Answers
@mwanderson71 did you find any solution for that?
@mangita are you having the same issue? Post your code here and ill look at it
Please use the proper formatting for your code, the instructions are below the reply input text box.
@mwanderson71 @jLinux
I am having the same issue after trying to replicate the code from datatables doc.
Please check this for me ASAP.
index.html
app.js