- edited description
Invalid order_by arguments: ['']
order_columns = ['', 'user', 'state', '', '']
my datatable
var profiletable = $('#mytable').DataTable( {
"processing": true,
"serverSide": true,
scrollY: '55vh',
scrollCollapse: true,
"ajax": "{% url 'order_list_json' %}",
"columnDefs": [{"orderable": false , "searchable": false, "targets": 0 },]});
even if i have made 0th column orderable:false , datatable still sends order[0][column]:0 in the GET request , may be this situation is not handled in 'django-datatables-view'
Comments (3)
-
reporter -
repo owner - changed status to invalid
The problem is that datatables are sending id of the column that is not orderable. This should not happen, and I think it happens because you've not set initial order for datatables: http://datatables.net/reference/option/order and/or your browser 'remembers' previous ordering by first column.
I'd say that 'django-datatables-view' are handling this situation because it lets you set some ordering for the invalid column, though in your case it's empty string ''.
I'd recommend setting default ordering and clearing browser cache/cookies/clicking on another column to sort by.
-
reporter I disabled the initial ordering by passing :
"order": []
although as given here in the first example , it says
# displayed by datatables. For non sortable columns use empty # value like '' order_columns = ['number', 'user', 'state', '', '']
also i think for the the nonsortable columns ('' in order_columns[]) must have
"columnDefs": [{"orderable": false , "targets": 3 },{"orderable": false , "targets": 4 }]
on datatables setup , since this was not metioned in example that caused some confusion.
also if first column is mentioned to be unsortable in order_colums[] ,the initial ordering must be disabled or set to a different column on related datatable , as it turns out if u dont explicitly set ordering for initialization, datatable applies ordering on first column. Thanks for ur contribution.
- Log in to comment