Sum of the columns

Sum of the columns

cmpluscmplus Posts: 58Questions: 12Answers: 0
edited March 2023 in Free community support

Hello, I inserted this code to add the columns, it works but I have a problem, I would like to exclude the columns containing the percentages from the sum and I would like to be able to also add the numbers that I have in the table with a divisor point, can someone help me to change the code?

Aug               516      1,465,334
April              368       280.075
December        0        1,166,294
February       398      202.608
January         570      225.596
June              569       756.230
July                260     1,227,357
May                580      407788
March             458       247.697
November         0       1.148.931
Total No.         3,719
                        drawCallback: function () {
                            var api = this.api();
                            var sum = 0;
                            var formated = 0;

                            $(api.column(0).footer()).html('Totale');

                            for(var i=1; i<=3;i++)
                            {
                                sum = api.column(i,).data().sum();

                                formated = parseFloat(sum).toLocaleString('it');
                                $(api.column(i).footer()).html('NĀ° '+formated).toFixed(2);
                            }
                        },

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.