Loading very large set of data from an API
Loading very large set of data from an API
Hi,
I am dealing with VERY large data and populating it to Datatable and I am aware that this should be done in a server-side process with querying to database. The problem is, I am only limited to getting data from an API which returns JSON data with hundreds of records. How can I make Datatable faster having very large data on that source.
Here's what im doing it:
javascript
datatble = tableElement.DataTable({
"ajax": {"url": 'phpScript.php'},
rowId: "info.ID",
"columns": [
{
"className": 'expand-details',
"orderable": false,
"data": null,
"defaultContent": ''
},
{"data": "info.datasample2"},
{"data": "info.sample"},
],
"deferRender": true,
"iDisplayLength": 10,
"aLengthMenu": [[10, 25, 50, 75, 100, -1], [10, 25, 50, 75, 100, "All"]],
"aaSorting": [[1, 'desc']],
"language": {
"loadingRecords": "Loading Records...<i class='fa fa-spinner fa-spin'/>",
"zeroRecords": "No records found",
},
});
phpScript.php
<?php
var jsondata = file_get_contents('123.1.1.1/api/getLargeData');
echo json_encode(jsondata);
Answers
How many records are we talking here? I would only expect slow down when using tens of thousands of records with the above.
Can you link to the page so I can profile it?
Thanks,
Allan