how to sum and average various columns at same time

how to sum and average various columns at same time

Answers

  • winntixwinntix Posts: 5Questions: 2Answers: 0

    sorry , chechk the footer on the second table

    thanks

  • winntixwinntix Posts: 5Questions: 2Answers: 0

    make a view page source and look the code

  • winntixwinntix Posts: 5Questions: 2Answers: 0

    after make a search on the web (googled) i found this solutions

    "fnFooterCallback": function (nRow, aasData, iStart, iEnd, aiDisplay) {

            var columnas = [1,2,3,4,5,6,8,10,11,12,13,14,15,16,17,18]; //the columns you wish to add            
            for (var j in columnas) {
                var columnaActual = columnas[j];
                var total = 0;
                for (var i = iStart; i < iEnd; i++) {
                    total = total + parseFloat(aasData[aiDisplay[i]][columnaActual]);
                }
                $($(nRow).children().get(columnaActual)).html(total);
    
            } // end of columns sum
    
            var columnas = [7,9]; //the columns you wish to average            
            for (var j in columnas) {
                var columnaActual = columnas[j];
                var total = 0;
                for (var i = iStart; i < iEnd; i++) {
                    ncolumns=iEnd;
                    total = total + parseFloat(aasData[aiDisplay[i]][columnaActual])/ncolumns;
                }
                $($(nRow).children().get(columnaActual)).html((total).toFixed(3));
    
            } // end of averages colummns
    
        } // end footercallback
    
This discussion has been closed.