Skip to main content
All docs
V25.2
  • GridSelectedRowsExportMode Enum

    Lists values that specify whether the Grid preserves group settings in ExportSelectedRowsOnly mode.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    Declaration

    public enum GridSelectedRowsExportMode

    Members

    Name Description
    Flat

    The Grid exports selected rows as a flat list.

    KeepGrouping

    The Grid exports selected records and corresponding group rows.

    Related API Members

    The following properties accept/return GridSelectedRowsExportMode values:

    Remarks

    When exporting Grid data to PDF/XLS/XLSX, enable the ExportSelectedRowsOnly property to export selected rows only. Once enabled, the Grid component ignores group settings and exports records as flat data. Set SelectedRowsExportMode to KeepGrouping to export selected records and their parent group rows.

    The following example exports selected records and corresponding group rows to PDF:

    @rendermode InteractiveServer
    @using DevExpress.Drawing;
    @inject WeatherForecastService ForecastService
    
    <DxGrid @ref="Grid" Data="@forecasts" ShowGroupPanel="true">
        <Columns>
            <DxGridSelectionColumn Width="60px" AllowSelectAll="true" />
            <DxGridDataColumn Caption="Date" FieldName="Date" />
            <DxGridDataColumn Caption="Temperature (C)" FieldName="TemperatureC" />
            <DxGridDataColumn Caption="Temperature (F)" FieldName="TemperatureF" />
            <DxGridDataColumn Caption="Summary" FieldName="Summary" GroupIndex="0" />
        </Columns>
        <ToolbarTemplate>
            <DxToolbar>
                <DxToolbarItem Text="Export to PDF" Click="ExportPdf_Click" BeginGroup="true" />
            </DxToolbar>
        </ToolbarTemplate>
    </DxGrid>
    
    @code {
        IGrid Grid;
        object forecasts;
    
        protected override async Task OnInitializedAsync() {
            forecasts = await ForecastService.GetForecastAsync();
        }
        async Task ExportPdf_Click() {
            await Grid.ExportToPdfAsync("ExportResult", new GridPdfExportOptions() {
                ExportSelectedRowsOnly = true,
                SelectedRowsExportMode = GridSelectedRowsExportMode.KeepGrouping
            });
        }
    }
    

    PDF Export - Flat Selected Rows Export Mode

    See Also