I am trying to load 25600 rows into datatables but it's taking around 10 seconds. The request is via an ajax API call.
views.py
@api_view()
def get_all_data(request):
get_all_data_ = Data.objects.values("name","contact_number","email_address","address","age",
"location_type","sector","phase","total_data","total_usage","city","district")
return JsonResponse(list(get_all_data_), safe=False)
template.html
var table = $('#data-table').DataTable({
serverSide: true,
"ajax": {
"url": "/alldata/",
"dataSrc": ""
},
"columns": [
{"data": "name"},
{"data": "contact_number"},
{"data": "email_address"},
{"data": "address"},
{"data": "age"},
{"data": "location_type"},
{"data": "sector"},
{"data": "phase"},
{"data": "total_data"},
{"data": "total_usage"},
{"data": "city"},
{"data": "district"}
],
});
How can i make it instantaneous?
What I would do:
If you really want to make it faster with the whole table: