I have to sort the rated data column in the datatable. The rated data contains star as the rating out of 5. the data is coming properly but it is not getting sorted. i m using theme roller css in datatables and data table is created with following code.
$('#data_table').dataTable( {
"aaData": dataSet ,
"bSort":true,
"aaSorting": [[0,'desc'],[0,'asc'],[2,'asc'],[2,'desc']],
"iDisplayLength": 4,
"bInfo": true,
"bLengthChange": false,
"bJQueryUI": true,
"bPaginate": true,
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"bAutoWidth": true,
"aoColumns": [
{ "sTitle": "Seller",
"sWidth": "155px",
"sClass": "grey" ,
"fnRender": function(obj) {
var data = obj.aData[ obj.iDataColumn ];
return "<a href='"+ data.url +"'>"+ data.title +"</a>";
}
},
{
"sTitle": "Seller rating",
"sClass": "center grey",
"sWidth": "100px",
"fnRender": function(obj) {
var sReturn = obj.aData[ obj.iDataColumn ];
var val = obj.aData[ obj.iDataColumn ];
if ( sReturn != "N/A") {
$('#fixed').raty({
readOnly: true,
start: val
});
sReturn = $('#fixed').html();
$('#fixed').html("");
}
return sReturn;
}
})
I want the seller rating column which is the rated column using star as the image. to be sorted according to the star it has.
bUseRendered (columns)
When using fnRender() for a column, you may wish to use the original data (before rendering) for sorting and filtering…
EDIT