Data columns don't resize with json
Data columns don't resize with json
allthestairs
Posts: 2Questions: 0Answers: 0
I am using a very slightly modified version of the http://datatables.net/development/server-side/django tutorial. I have my page working perfectly using Django templates to make a normal html table, it looks excellent. When I switch to server-side data and processing, using the exact methods in that repo, the columns stop resizing to fit their content. I have the exact same 5 columns with the same data in them. The only difference in my template/javascript is I add
[code]
"sAjaxSource": "{% url get_protein_list %}",
"bServerSide": true,
[/code]
to my $('#main').dataTable() function, and remove the part of the template that generates my ... section.
http://debug.datatables.net/ahofil - Server-side
http://debug.datatables.net/oramac - Normal
[code]
"sAjaxSource": "{% url get_protein_list %}",
"bServerSide": true,
[/code]
to my $('#main').dataTable() function, and remove the part of the template that generates my ... section.
http://debug.datatables.net/ahofil - Server-side
http://debug.datatables.net/oramac - Normal
This discussion has been closed.
Replies
[code]
fnInitComplete: function () {
this.fnAdjustColumnSizing();
}
[/code]
to your DataTables initialisation, which will do a column resize when the JSON has loaded for the first time. If you want it to adjust one every draw, use fnDrawCallback.
Allan