hi
i use a pivot table functionality.i want one more math function count, like other sum,average,min,max
is it possible to add count function.which returns total count.?
And i also want to display a specific math function in to drop down.like i want to display only sum and average in
to drop down not min and max.
Can you please guide on the above.waiting for your reply.
Thanks,
Two add any additional action you need to made modification in dhtmlxgrid_pivot.js
line 77
var z4=this.makePivotSelect([“Summ”,“Min”,“Max”,“Average”],-1);
you can add label here and define function named as
dhtmlXGridObject.prototype._pivot_action_N=function(a,b,c,av,bv,data){
where N - position in function list
For example to add Count
var z4=this.makePivotSelect([“Summ”,“Min”,“Max”,“Average”,“Count”],-1);
…
/// count function
dhtmlXGridObject.prototype._pivot_action_4=function(a,b,c,av,bv,data){
var ret=0;
var resA=data[a]; //x value
var resB=data[b]; //y value
var resC=data[c]; //cell value
for (var i = resA.length - 1; i >= 0; i–) // for each x
if (resA[i]==av && resB[i]==bv) { // if cell related to current pivot element
ret++; //increase return count
}
return ret;
}
The function will be called against each element in pivot, you can take it as is and just update line which do real calculation.