How to sort the currency data column with text and anchor tag html?

How to sort the currency data column with text and anchor tag html?

SatishNSatishN Posts: 1Questions: 0Answers: 0

Hello,

We are using data tables 1.10 plugin for sorting the table. Issue is with sorting the numeric data with mix of text and anchor tags.

Below is the column data example (Please find image attached)

$940.47/mo
$1,665.00 Fees
More Details

Code as follows, We disabled initial sort and calling datatables.fnSort(sortID, 'asc') method to apply sort on table data. But with the data mentioned
above sort is not working accordingly.

_self.oDataTable = $('#_Sdom').dataTable({

        "sDom": "rt", 
        "bAutoWidth": false,
        "iDisplayLength": 99, 
        "oLanguage": {
          "sZeroRecords": "Your search didn't return any results. Please try again."
        },
       "aoColumns": [
          { 'sType': 'string', 'aTargets': [ 0 ] },
          { 'asSorting': ['asc'], 'aTargets': [ 0 ] },
          { 'asSorting': [ 'asc' ], 'aTargets': [ 1 ] },
          { 'asSorting': [ 'asc' ], 'aTargets': [ 2 ] },
          { 'asSorting': [ 'asc' ], 'aTargets': [ 3 ] },
          { 'bSortable': false, 'aTargets': [ 4, 5 ] }
        ],

        "aaSorting":[] 

});

Calling sort method on Onchange of dropdown

$('#sortLenders').on('change',function(e) {
var sortId = $(this).find('option:selected').attr('data-value');
_self.oDataTable.fnSort([[sortId,'asc']]);
});

Is there any way to sort such mixed data as per numeric, num-html column type seems not working. ng.

This discussion has been closed.