Sorting breaks when trying to use columns.orderData with order
Sorting breaks when trying to use columns.orderData with order
In my datatable, I have two columns which I want to do a multi-column default sort. However, the columns I want to sort by are for display purposes only, the actual values I want to sort by are in hidden columns. It worked in 1.9, but I'm trying to upgrade to 1.10 and change all the hungarian notation to camelcase. The code below (also in JS Fiddle link above) doesn't work... the columns aren't sorted and trying to click the header to sort does nothing:
$(document).ready(function () {
var table = $('#example').DataTable({
order: [
[3, 'asc'],
[1, 'asc']
],
columns: [
null, {
orderData: 2
}, {
visible: false
}, {
orderData: 4
}, {
visible: false
}]
});
});
If I change the orderData
to iDataSort
, everything works as expected, but I'm trying to get away from the hungarian notation.
If I change the order
to use columns besides the columns that contain orderData
... that also works, but then I don't get the columns being sorted the way I want.
Any ideas? Is this a bug or is there a new way to do this?
This question has an accepted answers - jump to answer
Answers
Seems to work if I just make this change:
Ah, good catch. According to the documentation,
orderData
should also accept an integer, but I'm fine with using a single-value array.You're right, I wonder if it's a bug...
Its a bug. Thanks for letting me know.
Allan