Sorting is not working properly
Sorting is not working properly
Ashish Sontakke
Posts: 3Questions: 2Answers: 0
While clicking on column for sort arrows are visible on other column as shown in attached files
This discussion has been closed.
Answers
If you don't want other columns to be sorted, disable "orderable" for those columns.
https://datatables.net/reference/option/columns.orderable
Hi Tangerine,
I add "orderable" = false to each columns that don't want to sort. please look at code below
$('#gvClass').DataTable({
Data:
$.each(jsonObj, function (i, item) {
var $tr = $('<tr>').append(
$('<td>').html("<button type='button' onClick='ClassById(" + item.classid + ")' class='btn btn-link ' id='btnEditClass'><span class='glyphicon glyphicon-edit'></span> Edit</button> "),
$('<td>').html("<button type='button' onClick='DeleteClass(" + item.classid + ")' class='btn btn-link ' id='btnDeleteClass' style='color:red;'><span class='glyphicon glyphicon-trash' style='color:red;'></span> Delete</button> "),
$('<td>').text(item.classname)).appendTo('#gvClass');
}),
columns: [{ orderable: false, "width": "5%" }, { orderable: false, "width": "5%" }, { orderable: true, "width": "90%" }],
lengthMenu: [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
scrollY: '50vh',
scrollCollapse: true,
paging: true,
aaSorting: [[2, 'asc']],
language: {
"emptyTable": "Class not available "
}
});
Good. And did it work or not? If not, please link to a test case showing the issue.
Allan