Sorting not working on some columns when custom calculations added
Sorting not working on some columns when custom calculations added
SarahSuth
Posts: 1Questions: 1Answers: 0
I am having an issue sorting a column now that custom calculations have been added.
I was able to get the column to show in descending order by adding "aaSorting": [[ 2, "desc" ]]
No luck with the actual sorting of the column header on click though.
var table = $("#" + this.tableId).dataTable({
data: tableData,
destroy: true,
empty: true,
lengthChange: false,
searching: false,
bInfo: false,
paging: false,
scrollY: currentTableSize,
percentage: this.percentage,
columns: [
{width: '40%'},
{order: 'desc'},
],
columnDefs: [
{
targets: this.dataColumns,
render: function(data, type, row, meta) {
var percentage = meta.settings.oInit.percentage;
return ChartDataTable.getFormattedDataCell(data, percentage);
},
className: 'text-right'
},
{
targets: [0],
render: function(data) {
return data;
},
className: 'text-left'
},
{
targets: this.totalColumn,
render: function(data, type, row) {
return ChartDataTable.getFormattedChangeCell(data);
},
className: 'text-right'
}
],
"aaSorting": [[ 2, "desc" ]],
This discussion has been closed.