JQuery DataTables Custom Column Sorting

JQuery DataTables Custom Column Sorting

kralco626kralco626 Posts: 1Questions: 0Answers: 0
edited October 2013 in General
I have a column that contains several images. I would like to perform custom sorting on this column based on the sort property of the `` tag.

My html looks like this: [code][/code]

I am trying to implement a sort function like this:
[code]
$.fn.dataTableExt.afnSortData['dom-custom-options'] = function ( oSettings, iColumn )
{
console.log("test");
return $.map( oSettings.oApi._fnGetTrNodes(oSettings), function (tr, i) {
console.log($('td:eq('+iColumn+')', tr).prop('sort'));
return $('td:eq('+iColumn+')', tr).prop('sort');
} );
}
[/code]
I have tried two solutions for the dataTables initialization, neither have worked:
[code]
"aoColumnDefs":
[
{"aSortDataType": "dom-custom-options", "aTargets": [ 3 ] }
]
[/code]
and
[code]
"aoColumns": [
null,
null,
null,
{"aSortDataType": "dom-custom-options"},
null
]
[/code]
When I click on the column to sort, nothing is written to the console, therefore my custom sorting function is not getting used.

What am I doing wrong?
This discussion has been closed.