Skip to main content

ASPxClientGridView.GroupBy(column) Method

Groups data by the values of the specified data column.

Declaration

GroupBy(
    column: ASPxClientGridViewColumn | number | string,
    groupIndex?: number,
    sortOrder?: string
): void

Parameters

Name Type Description
column string | number | ASPxClientGridViewColumn

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.

Remarks

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:

  • The column’s grouping level.
  • The column’s sort order.

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>
<br />
<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