You can take advantage of orthogonal data, which lets you store a custom sorting value, which is different from the display value:
$('#my-table').DataTable( {
columnDefs: [ {
targets: [ 0 ],
render: function ( data, type, row ) {
if ( type === 'sort' ) {
var sortValue = data;
switch( data ) {
case '-':
sortValue = -999998;
break;
case 'NA':
sortValue = -999999
break;
default: // already set, in this case
}
return sortValue;
} else {
return data;
}
}
} ]
} );
This assumes you will never have numeric values lower than the two values used in the switch
statement. You can adjust as needed, if your overall data is not compatible with this.
My sample:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…