Count specific cell's in grouped column

Hi,

I have a grid with:

mygrid.groupBy(1);

Now I found the following:
grid.groupBy(1,["#stat_max","#title","","#stat_total","","#cspan","#cspan","#cspan"]);
but this doesn’t do exactly what I want.

I want something like “#count_all_cells_in_this_group_with_value=‘teddy’_and_value=‘peaches’”

So when there are 3 cells with ‘teddy’ and 1 with ‘peaches’, the result should be 4.

is this possible and how?

thanks!!!

up,

is there a solution please?

You can create custom stat counter which will calculate necessary values docs.dhtmlx.com/doku.php?id=dhtm … cs_count&s[]=counter

Hi,

I cannot find how to make this work in the header of the groupby…

Can you please give me an example?

I tried the following:

mygrid = new dhtmlXGridObject("gridbox");
mygrid.setImagePath("codebase/imgs/");
mygrid.setEditable(true);

mygrid._in_header_stat_max=function(tag,index,c){      
      var calck=function(){                              
      return "this is a test";
      }
      this._stat_in_header(tag,calck,index,c);           
  }
  
mygrid.setSkin("light");
mygrid.setHeader("<?php echo $head; ?>");
mygrid.setColTypes("sasu,ro,ro,edC,edC,edC,edC,edC,edC,edC,edC,edC,edC,edC,edC,edC,edC,edC");  mygrid.setColAlign("left,left,left,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
mygrid.setColSorting("na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na,na");                                 mygrid.enableResizing("true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true");
mygrid.enableRowsHover(true,'grid_hover')
mygrid.init();          
mygrid.load("XML.php",function(){
mygrid.groupBy(1,["#title","#cspan","#cspan","#stat_count","#stat_max"]);                                     
mygrid.collapseAllGroups();
});       

myDP = new dataProcessor("XML2.php");
myDP.init(mygrid);

Can you please tell me what is wrong in the code?

please???

Can someone of the support-team please take a look at this.
I appreciate your help, you people are doing a fantastic job!

tx!

Check the attached sample, it shows how custom group-by counter can be implemented.
The one in the sample counts cells where value > 8, similar to it any other custom counting logic can be added
1318001342.ZIP (123 KB)

Thank you for the example!
I was able to find how to make this work with strings!

This issue is solved, the code is working perfect!!

Tx!!

Is it also possible to check another value in the same row?

So not “n”, but : "value-in-first-column-of-row(n)?

thanks again!