# Angular Data Grid Manual Grouping

The manual grouping gives the developer full control over the grouping of the data. Compared to the [grouping with the built-in directive](https://www.telerik.com/kendo-angular-ui-develop/components/grid/grouping/basics#automatic-data-processing), the manual approach provides greater transparency of the grouping process because it requires you to handle the [Angular Grid](https://www.telerik.com/kendo-angular-ui-develop/components/grid) events manually. The manual grouping is especially useful when you require additional customization of the grouping logic.

To enable the grouping feature using the manual setup approach:

1. Set the [`groupable`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#groupable) property of the Grid.
2. Bind the [`group`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#group) option to a [`GroupDescriptor`](https://www.telerik.com/kendo-angular-ui-develop/components/data-query/api/groupdescriptor) object.
3. To group [local data](https://www.telerik.com/kendo-angular-ui-develop/components/grid/grouping/manual-grouping#grouping-local-data) or send a [remote service request](https://www.telerik.com/kendo-angular-ui-develop/components/grid/grouping/manual-grouping#grouping-on-the-server), handle one of the following events:
   * [`groupChange`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#groupchange) event—Use this event when you enable only the grouping data operation.
   * [`dataStateChange`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#datastatechange) event—Use this event when you enable more than one data operation, for example, grouping and filtering. For more details, check the section on how to [handle multiple data operations](https://www.telerik.com/kendo-angular-ui-develop/components/grid/data-operations#handling-multiple-data-operations).

> The order of the groups follows the default order of the field data type.

## Grouping Local Data

The [Data Query](https://www.telerik.com/kendo-angular-ui-develop/components/data-query) package provides built-in methods that enable you to group local data. These methods apply the [`GroupDescriptor`](https://www.telerik.com/kendo-angular-ui-develop/components/data-query/api/groupdescriptor) object to the Grid. Which method to use depends on the number of enabled data operations:

* [`groupBy()`](https://www.telerik.com/kendo-angular-ui-develop/components/data-query/api/groupby)—Use this method when grouping is the only enabled data operation.
* [`process()`](https://www.telerik.com/kendo-angular-ui-develop/components/data-query/api/process)—Use this method when more than one data operation is enabled, for example, grouping and filtering.

> When you enable multiple data operations, handle the `dataStateChange` event instead of the `groupChange` event  and use the `process()` method. For more details, check the section on how to [handle multiple data operations](https://www.telerik.com/kendo-angular-ui-develop/components/grid/data-operations#handling-multiple-data-operations).

The following example demonstrates how to group the data by using the `groupChange` event and the `groupBy` method.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/grouping/manual-grouping/source.txt)

## Grouping on the Server

Handle the [`groupChange`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#groupchange) or [`dataStateChange`](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent#datastatechange) event to send a request containing information about the current Grid state to the server. See the section on [handling multiple data operations using remote data](https://www.telerik.com/kendo-angular-ui-develop/components/grid/data-operations#processing-data-on-the-server) for an example.

## Suggested Links

* [Aggregates](https://www.telerik.com/kendo-angular-ui-develop/components/grid/grouping/aggregates)
* [Group Templates](https://www.telerik.com/kendo-angular-ui-develop/components/grid/grouping/manual-grouping)
* [API Reference of the GridComponent](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api/gridcomponent)
* [API Index of the Grid](https://www.telerik.com/kendo-angular-ui-develop/components/grid/api)
