TMS FireMonkey Grid

Example 2 : Group demo

FireMonkey grid

Clicking the group button groups the Brand column and shows a group header and summary row with the total / average of the Kw and Price column. Clicking on a node collapses the group. To return to a normal state, click on the ungroup button. To close all nodes at once, click on the Close all nodes button.

This demo's also demonstrates sorting in normal and grouped mode. Clicking on a column in group mode will sort the data specific to that group, resulting in a correct display of the sorted data.

To group grid data according to the demo use the following code below:
	TMSFMXGrid1.SortData(1,sdAscending);
	TMSFMXGrid1.Options.Grouping.MergeHeader := true;
	TMSFMXGrid1.Options.Grouping.Summary := true;

	TMSFMXGrid1.Group(1);
	TMSFMXGrid1.GroupSum(6);
	TMSFMXGrid1.GroupAvg(5);