Implementing Datatables in Django

datatables

 

DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, built upon the foundations of progressive enhancement, that adds all of these advanced features to any HTML table.

I've been using this plug-in for almost every project that I'm involve with. It has a built-in search, sorting and pagination facility. Less hassle and simple to implement specially in dealing with huge datasets such as 100,000+ or even millions. It's UI can be in Bootstrap, among others.

Implementing it in Django requires proper format, it should follow the required structure of JSON and the table itself.

Django views.py and urls.py

Create a function in views.py that will handle sorting, searching and pagination of your table. To start,


In your HTML file.

Some common error encountered is on columns, make sure the index are properly matched!

Comments

Popular posts from this blog

A Better Archive Page for Blogger

Publish PostGIS Layers in GeoServer Automatically using cURL and REST

BECK Live Action