0

In brief sight, to use django's Paginator class, we need to paginate from backend. But most of web pages are doing pagination at frontend.

Is it possible doing frontend pagination with django's Paginator? Or should I just give it up and use datatables with giving all data to client?

adover
  • 19
  • 6
  • 2
    Yes, you need to create an API that returns your paginated data (most likely as JSON) and use JavaScript on the client-side to fetch data from that API – Iain Shelvington Aug 29 '22 at 07:51
  • @IainShelvington I can't understand what you mean fully. So, should I give 'all of paginated data' to client by creating API? If then, what about giving a Paginator class that paginated the data? – adover Aug 29 '22 at 07:56
  • 1
    Since you mention datatables there is a package that supports doing the paging, ordering, searching etc. using ajax: [django-ajax-datatable](https://pypi.org/project/django-ajax-datatable/). What Iain Shelvington means is that you can create an API, your frontend will request paginated data from it, the API will use the Paginator, get the paginated queryset, serialize it, and then return the serialized data to your frontend. – Abdul Aziz Barkat Aug 29 '22 at 08:02
  • @AbdulAzizBarkat thank you for explanation. I'd search about it. – adover Aug 29 '22 at 08:06

0 Answers0