Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by withzestmn on May 10, 2009 15:38
open dhtmlx forum
recalculate total in group after setRowHidden

Hi,~

I'm using stat_total/average function in each group of dhtmlxgrid 2.1 pro version.
I want this total value to recalculate after I call setRowHidden() except for this hidden row.

I modified the following function when ungroup status. (2.0version)
dhtmlXGridObject.prototype._in_header_stat_total = function(t, i, c){
var calck = function(){
var summ = 0;
for (var j = 0; j < this.rowsBuffer.length; j++) {     
    var tmpR = this.rowsBuffer[j]
    if(tmpR.style.display != "none"){ //<- Update
     var v = parseFloat(this._get_cell_value(this.rowsBuffer[j], i));
     summ += isNaN(v) ? 0 : v
    }
};
return this._maskArr[i] ? this._aplNF(summ, i) : (Math.round(summ * 100) / 100)
};
this._stat_in_header(t, calck, i, c, c)
};

But, the following isn't called after setRowHidden() for total calculation in each group,(2.1version)
dhtmlXGridObject.prototype._g_stat_total=function(c,n,i){
    return Math.round(c+n) //Update : Math.round
};

How can I call this function after setRowHidden() ?
And I want to modify this to recalculate rows in each group except for hidden row.

BRs,
Mina.
Answer posted by dhxSupport on May 11, 2009 02:57

Try to call "onGridReconstructed" event after you hiding rows:

grid.callEvent("onGridReconstructed",[])