Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on May 13, 2009 03:47
open dhtmlx forum
groupby

after groupby i want to show for each group how much percentage contributing from all groups

ex :

- Name 1 (3) 60%
row 1
row 2
row 3
- Name 2 (2) 40%
row 4
row 5

how can i show each group percentage ?


mygrid.customGroupFormat=function(name,count){
var total=mygrid.getRowsNum();
var percent=Math.round((count*100)/total);
return name+"(" +count+ ")"+percent+"%";
}


thank you so much for your quick reply.
but in my case percentage calculation is like.........
i am calculating totals for each group.
take one particular column for ex column1
group1 row : (total of column1 for group1 / whole total of column1) * 100
group2 row : (total of column1 for group2 / whole total of column1) * 100







Answer posted by dhxSupport on May 13, 2009 04:59
All columns in grid have equal number of rows. In the customGroupFormat function "count" attribute means how much rows is in the particular group.