[Fixed]-Django Datatables from model

1👍

From the datatables manual:

For DataTables to be able to enhance an HTML table, the table must be valid, well formatted HTML, with a header (thead) and a body (tbody). An optional footer (tfoot) can also be used.

so your table is missing the required thead and tbody tags.

0👍

Unless your table has an id of myTable, then it’s not going to work. It looks like you should change your jquery selector to be $('#users') because that’s the table id that you have set in the code posted above.

0👍

In addition to thr table thead and tbody comment, Jquery datatables will automatically sort your table by the 1st column if you are using the default datatables constructor.

Leave a comment