Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Uwe on Feb 08, 2008 04:04
open dhtmlx forum
Colum Sum after Filter (footer)

Hi,

i have problems with Colum Sum in footer after setting a Filter- the Sum of the colum ist the sum over all, every time, but i want to have only the sum for the displayed rows. Is that possible?

I use the function of the examples:

function calculateFooterValues(stage){
         if(stage && stage!=2)
         return true;
         var nrQ = document.getElementById("nr_q");
         nrQ.innerHTML = sumColumn(12) // 12 = c12 my colum
          return true;     }
        
        
         function sumColumn(ind){
         var out = 0;
         for(var i=0;i<mygrid.getRowsNum();i++){ out+= parseFloat(mygrid.cells2(i,ind).getValue())
         }         return out;    }

Thank you
Uwe
Answer posted by Support on Feb 08, 2008 07:56
You can add next line of code which most probably will solve issue

mygrid.attachEvent("onFilterEnd",function(){   //called each time after filtering
    calculateFooterValues(2);
});

Also, latest version supports automatic sum counters
    http://dhtmlx.com/docs/products/dhtmlxGrid/samples/filtering/pro_filter_num.html