Skip to main content

GridRowExportingEventArgs.IsGroupRow Property

Indicates whether the processed row is a group row.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public bool IsGroupRow { get; }

Property Value

Type Description
Boolean

true if a group row is being processed; false if a data row is being processed.

Remarks

The grid calls the RowExporting action before exporting a data or group row. Use the IsGroupRow property to determine the type of the row currently being processed.

The following argument properties allows you to get additional information about the row.

  • For a data row, use the DataItem property to get a data source item that corresponds to the currently being processed row.
  • For a group row, use the GroupFieldName property to get the name of a data source field that is bound to the processed group column.

Example

The code sample below demonstrates how to export rows that contain values larger than 1000 in the Total column.

<DxGrid @ref="Grid" Data="@Data" >
    <Columns>
        <DxGridDataColumn FieldName="CompanyName" />
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="Quantity" />
        <DxGridDataColumn FieldName="Total" UnboundType="GridUnboundColumnType.Integer" 
                          DisplayFormat="c" UnboundExpression="[UnitPrice]*[Quantity]" />
    </Columns>
</DxGrid>
<DxButton Text="Export Big Deals to XLSX" Click="ExportXlsx_Click" />
@code {
    object Data { get; set; }
    IGrid Grid { get; set; }
    protected override async Task OnInitializedAsync() {
        var invoices = await NwindDataService.GetInvoicesAsync();
        var customers = await NwindDataService.GetCustomersAsync();
        Data = invoices.OrderBy(i => i.OrderDate).Join(customers, i => i.CustomerId, c => c.CustomerId, (i, c) => {
            return new {
                OrderDate = i.OrderDate,
                CompanyName = c.CompanyName,
                City = i.City,
                Region = i.Region,
                Country = i.Country,
                UnitPrice = i.UnitPrice,
                Quantity = i.Quantity
            };
        });
    }
    async Task ExportXlsx_Click() {
        var options = new GridXlExportOptions();
        // Exports rows with Total value larger than 1000
        options.RowExporting = e => {
            if (!e.IsGroupRow) {
                if ((int)e.GetRowValue("Total") < 1000) {
                    e.Cancel = true;
                }
            }
        };
       await Grid.ExportToXlsxAsync("Big Deals", options);
    }
}

Grid - Exported big deals

See Also