Populating DataTables with JSON in JavaScript Array
Populating DataTables with JSON in JavaScript Array

I have an array with JSON in it called customers.
How do I load this data into the Datatable?
$('#all_customers_table').DataTable( {
dataSrc: 'customers',
} );
Unfortunately, this doesn't work. Any ideas on how to add a JSON array into a DataTable?
This discussion has been closed.
Answers
Hi mscola,
You need to be using the
data
option inside your DataTable function call.The manual explains this. For you, it is probably best to please refer to the Arrays and Data Sources - Javascript sections. Here is the link - https://datatables.net/manual/data/
I've also written up a week example for you which can be found at this link - http://live.datatables.net/zakanota/1/edit
Hopefully this helps,
Sandy