Hi, I have grouped two column and showing the total price against the grouped column . How can I f
Hi, I have grouped two column and showing the total price against the grouped column . How can I f
polachan
Posts: 101Questions: 50Answers: 0
I want to add currency sign and format with two decimal places for the grouped column Please help
rowGroup: {
dataSrc: ["DepotName", "EmpName"], /
startRender: function (rows, group,level) {
var total = rows
.data()
.pluck("Total")
.reduce(function (a, b) {
return a + b;
});
return $('<tr/>')
.append('<td class="td-left" >' + group + '</td>') .append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td style="font-weight:bold;text-align: right;"> </td>') // How can I add two decimal places in front of the value with currency sign £ against the grouped total column
.append('<td style="font-weight:bold">' + total + '</td>');
}
},
This discussion has been closed.
Answers
Here you are:
https://datatables.net/manual/data/renderers#Built-in-helpers
Here is an example from my own coding. Depending on the language I render numbers differently:
Please can you help me how to add in my code
return $('<tr/>')
.append('<td class="td-left" >' + group + '</td>') .append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td></td>')
.append('<td style="font-weight:bold;text-align: right;"> </td>') // How can I add two decimal places in front of the value with currency sign £ against the grouped total column
.append('<td style="font-weight:bold">' + total + '</td>');
Sorry, no, because I have no idea what you are doing there. Somebody else?
That is without a doubt the weirdest concatenation I have ever seen.
@rf1234 my best guess is that as per their second post asking this question today: here, they want to add a
$0.00
format value to the row group header as detailed here.But honestly, my guess is as good as the next guy's.