Custom ordering plugin not working
Custom ordering plugin not working
tomde
Posts: 1Questions: 1Answers: 0
I can't load custom filter. Tried to put breakpoint to filter return statement and it's not even called. I am using DataTables 1.10.8 and jquery v1.9.1. Here is my code:
$.fn.dataTable.ext.order['localizedPrice'] = function ( settings, col )
{
return this.api().column(col, {order:'index'}).nodes().map(
function ( td, i ) {
var value = $(td).val();
value = value.replace('€','');
return value * 1;
}
);
}
// in angular controller
$scope.dataTable = $('#dataTable').DataTable({
"columnDefs": [
{ "orderDataType": "localizedPrice", "targets": [ 3] },
{"sortDataType": "localizedPrice", "targets": [ 3 ] },
{ "type": "numeric", "targets": [ 3] },
],
"columns": [
null,
null,
null,
{ "type": "numeric", "orderDataType": "localizedPrice", "sortDataType": "localizedPrice" },
null
],
"aoColumns" : [
{ "mDataProp": "title" },
{ "mDataProp": "menuTitle" },
{ "mDataProp": "count" },
{ "mDataProp" : "priceAmount" },
{ "mDataProp" : "priceAmount" }
],
"aoColumnDefs": [
{
"aTargets" : [3],
"mRender" : function (data, type, full) {
return data+" "+ $scope.mainCurrency.symbol;
}
},
{
"aTargets" : [4],
"mRender" : function (data, type, full) {
return (data/$scope.accEntryValSum)*100+" %";
}
}
],
"fnCreatedRow" : function( nRow, aData, iDataIndex ) {
$compile(nRow)($scope);
},
"aaSorting": [[4,'desc']],
"aaData" : $scope.reportData
});
This discussion has been closed.