Unable to disable user column sorting
Unable to disable user column sorting
shawnMlarson
Posts: 2Questions: 1Answers: 0
I have been trying to disable column sorting for users on several of our tables columns, but have had no success. Here is my implementation. Does anyone have any suggestions.
Thanks
$(document).ready(function () {
var dataGrid = $('#alertsList');
var currentpage = 0;
if (dataGrid.length > 0) {
currentpage = $(dataGrid).DataTable().page.info().page;
}
dataGrid.dataTable({
'bRetrieve': true,
'pagingType': 'full_numbers',
'pageLength': 10,
'bStateSave': true,
'fnStateSave': function (oSettings, oData) {
localStorage.setItem('DataTables', JSON.stringify(oData));
},
'fnStateLoad': function (oSettings) {
return JSON.parse(localStorage.getItem('DataTables'));
},
'aoColumnDefs': [
{ 'bSortable': false, 'aTargets': [3, 4, 5, 9] }
]
}).columnFilter({
sPlaceHolder: 'head:after',
aoColumns: [
null,
null,
{ type: 'select', values: ['RQA', 'OrderChecker', 'OrderRite'] },
{ type: 'select', values: ['True', 'False'] },
null,
null,
null,
null,
null,
null
]
});
dataGrid.show();
dataGrid.DataTable().page(currentpage).draw(false);
});
This discussion has been closed.
Answers
Use the
columns.orderable
option to disable user controlled ordering.Allan
Thanks Alan, but I have tried that among many other suggestions. it just doesn't want to cooperate.
In which case can you link to a test page showing the issue so I can debug it please?
Allan