Can't sort column defined by a render function
Can't sort column defined by a render function

Hello,
I have this on columnDefs of a datatable in my js script:
columnDefs: [
{...}, //other columns that don't use render and work great
{...},
{
"render": function (data, type, row) {
return data === true ? '<div align = "center"><span class="glyphicon glyphicon-ok"></span></div>' :
'<div align = "center"><span class="glyphicon glyphicon-remove"></span></div>'
},
"targets": 2
}
As you can see, I have a boolean and use one glyphicon if this boolean is true, and another if it's false. Glyphicons work great, datatable draw them perfect. The problem comes on sorting, when I press the sort arrows, it doesn't sort. It doesn't give an error message or anything, it just doesn't sort correctly. I don't know how to make it sort well, something like "sort":data or anything like that. Any help would be appreciated.
Answers
In case it helps, I also wondered how to sort on a rendered column. In my case, I was rendering the data into an img specification. For presentation purposes, I want an IMG. For sorting purposes, I want to sort on the original raw data value.
Looks good to me. Also check out the orthogonal data manual page.
Allan