mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-11 17:46:20 +01:00
[FIX] Count filtered records before applying the limit
This commit is contained in:
@@ -195,6 +195,9 @@ class DataTablesView(View):
|
||||
*self.get_order(table_conf)
|
||||
)
|
||||
|
||||
# Get the count after filtering
|
||||
qs_count = qs.count()
|
||||
|
||||
# build output
|
||||
if length > 0:
|
||||
qs = qs[start:limit]
|
||||
@@ -210,7 +213,7 @@ class DataTablesView(View):
|
||||
datatables_data = {}
|
||||
datatables_data['draw'] = draw
|
||||
datatables_data['recordsTotal'] = self.get_model_qs(request, *args, **kwargs).all().count()
|
||||
datatables_data['recordsFiltered'] = qs.count()
|
||||
datatables_data['recordsFiltered'] = qs_count
|
||||
datatables_data['data'] = items
|
||||
|
||||
return JsonResponse(datatables_data)
|
||||
|
||||
Reference in New Issue
Block a user