aspnet-js-aspxclientgridview-dot-groupby-x28-column-x29.md
Groups data by the values of the specified data column.
GroupBy(
column: ASPxClientGridViewColumn | number | string,
groupIndex?: number,
sortOrder?: string
): void
| Name | Type | Description |
|---|---|---|
| column | string | number |
The data column | The column’s index | The column’s fieldName
| | groupIndex | number |
The column’s grouping level.
| | sortOrder | string |
The column’s sort order. Available values:
"ASC" or undefined to sort data in ascending order.
"DSC" to sort data in descending order.
"NONE" to clear sorting by column values.
|
Call the client-side GroupBy(column) method to group data in the grid by the column values. You can also specify the following parameters in the GroupBy(column) method:
To clear grouping applied to a particular column on the client side, call the UnGroup(column) method.
For more information on grouping in the grid, refer to the following topic: ASPxGridView - Group Data.
The code sample below groups data by the values of the Country column and sorts them in descending order.
<dx:ASPxGridView ID="grid" runat="server" ClientInstanceName="grid" KeyFieldName="CustomerID"
AutoGenerateColumns="False">
<Columns>
<dx:GridViewDataTextColumn FieldName="Country" VisibleIndex="0" />
<%--...--%>
</Columns>
<Settings ShowGroupPanel="true" />
</dx:ASPxGridView>
<dx:ASPxButton ID="button" runat="server" Text="Group Data" AutoPostBack="false">
<ClientSideEvents Click="OnClick" />
</dx:ASPxButton>
function OnClick(s, e) {
grid.GroupBy("Country", 0, "DSC");
}
See Also