I try to use datatables :server-side processing
I have a view :
class DataList(generics.ListAPIView):
queryset = Data.objects.all()
serializer_class = DataSerializer
And my html :
$(document).ready(function() {
$('#example').dataTable( {
"processing": true,
/* serverSide:true */
"deferRender": true,
"iDisplayLength": 25,
"paging": true,
ajax: {
url: 'http://127.0.0.1:8000/api/datas/',
dataSrc: ''
},
columns: [
{ "data": "id"},
{ "data": "name"},
{ "data": "update_time"},
{ "data": "description"},
]
});
});
This works good.
And then I comment out the serverSide:true :
$(document).ready(function() {
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"deferRender": true,
"iDisplayLength": 25,
"paging": true,
ajax: {
url: 'http://127.0.0.1:8000/api/datas/',
dataSrc: ''
},
columns: [
{ "data": "id"},
{ "data": "name"},
{ "data": "update_time"},
{ "data": "description"},
]
});
});
The paginator and search and ordering not work anymore
It seems like it query all data.
I see the datatable example is with php.
I want to intergrate datatable with django rest framework ,What else should I set ??