DHTMLX Docs & Samples Explorer

groupBy(ind,mask)

Required library edition: This method requires Professional Edition of the DHTMLX library
Required library file: dhtmlxgrid_group.js

group grid content by values of specified column

  • ind - {number} column index to group by
  • mask - {array} optional, array, each value of which is mapped to the related column. The possible values are:
    • title - will be used for group-key;
    • cspan - organize colspan with a sibling cell (the same as in cspan in header);
    • stat_total - calculates total of values for the group;
    • stat_max - calculates maximum value in the group;
    • stat_min - calculates minimum value in the group;
    • stat_average - calculates average value in the group;
    • stat_count - calculates count of records in the group.
   //minimal parameters set. Group rows by second column
   mygrid.groupBy(1);
   //maximal parameters set
   mygrid.groupBy(2,["#stat_max","#title","","#stat_total","","#cspan","#cspan","#cspan"]);

Note: this method is incompatible with enableSmartRendering, enablePaging and enableDistributedParsing methods

See also: collapseAllGroups, collapseGroup, expandAllGroups, expandGroup