[英]Django Datatables taking too long to load
I am trying to load 25600 rows into datatables but it's taking around 10 seconds.我正在尝试将 25600 行加载到数据表中,但大约需要 10 秒。 The request is via an ajax API call.
该请求是通过 ajax API 调用进行的。
views.py视图.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模板.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:如果你真的想让整张桌子更快:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.