I am using a data table that was provided in the gentella admin template.
This is the script i am using
$("#datatable-buttons").DataTable({
dom: "Bfrtip",
buttons: [
{
extend: "copy",
className: "btn-sm"
},
{
extend: "csv",
className: "btn-sm"
},
{
extend: "excel",
className: "btn-sm"
},
{
extend: "pdfHtml5",
className: "btn-sm"
},
{
extend: "print",
className: "btn-sm"
},
],
"aadata": [
{
"Name": "Tiger Nixon",
"Position": "System Architect",
"Office": "$320,800",
"Age": "2011/04/25",
"Start date": "Edinburgh",
"Salary": "5421"
},
{
"Name": "Garrett Winters",
"Position": "Accountant",
"Office": "$170,750",
"Age": "2011/07/25",
"Start date": "Tokyo",
"Salary": "8422"
},
{
"Name": "Ashton Cox",
"Position": "Junior Technical Author",
"Office": "$86,000",
"Age": "2009/01/12",
"Start date": "San Francisco",
"Salary": "1562"
},
{
"Name": "Cedric Kelly",
"Position": "Senior Javascript Developer",
"Office": "$433,060",
"Age": "2012/03/29",
"Start date": "Edinburgh",
"Salary": "6224"
}
],
responsive: true
});
This is the HTML code
<table id="datatable-buttons" class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody></tbody>
</table>
After running this code i am trying to display the JSON data in the table but it's not getting populated. What might be the problem?
aadatais case sensitive and should beaaDataand instead ofDataTableinitialize you should usedataTable...they are used for different purposesDataTables warning: table id=datatable-buttons - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4