How to sort by a column that is a function?
How to sort by a column that is a function?
jstuardo
Posts: 105Questions: 42Answers: 0
Hello.... I have this definition for a column:
{
data: function (row, type, val, meta) {
if (row) {
switch (row.sexo) {
case 'M':
return 'Masculino';
case 'F':
return 'Femenino';
default:
return '';
}
}
}
},
That column is orderable. When I press the column header to sort by that column, ordering column name that is posted to server is function
. I need posted name to be sexo
so that server can recognize it and order properly.
How can I do it?
Thanks
Jaime
This question has an accepted answers - jump to answer
Answers
I presume you are using server-side processing? If so do:
i.e. move the rendering into a
columns.render
function, rather than thedata
option, which should be set to the data point in the row you want to base the rendering on.Allan