I have a grid that I load using .load(…“xmlB”), with three headers. The first header is simply labels. The second header is a total of the values in that column, using:
mygrid.attachHeader("Total,#cspan,#cspan,#cspan,#stat_total")
The third header is that subtotal, plus a constant. I created a custom statistic counter named stat_sum_const1, as follows:
mygrid.attachHeader("Net,#cspan,#cspan,#cspan,#stat_sum_const1")
with script that is based on the sample code:
mygrid._in_header_stat_sum_krd30=function(tag,index,c){ // shortcut for statistics counter
var calck=function(){ // define the function which will be used for calculations
var summ=1234567; // set initial counter value
this.forEachRow(function(id){ // for each row
summ+=this.cells(id,index).getValue()*1; // add row_value
})
return summ;
}
this._stat_in_header(tag,calck,index,c); //call default statistics handler processor
}
In this case, I add 1,234,567 to the total. Then, lastly, I format the column with a thousands separator.
mygrid.setNumberFormat("0,000",thecolumn,".",",");
So the totals all work correctly, and the math in my custom addition works too, but the header that uses the standard #stat_total has comma separators, but the #stat_sum_const1 header does not (and has decimals going out much further).
Does anybody know why I get this behavior, and if there is anything I can do to get the formatting of the custom statistic counter to format correctly? Thanks