Blazor DataGrid Example - Template Column Exporting
This sample shows how the DataGrid supports exporting templates, enabling you to export the template column along with customized captions and footer aggregators in PDF and Excel file formats.
Order ID Press Ctrl space to group | Name Press Ctrl space to group | Email ID | Freight | Order Date Press Ctrl space to group | Ship Country Press Ctrl space to group |
|---|
Using the Template property, the Blazor DataGrid allows you to use a custom layout to display custom element values or content for each column. To specify custom content, use the GridColumn components of the Template component. You can access the data within the template by using the implicit named parameter Context.
Aggregates are supported by the Blazor DataGrid and will be displayed in the footer, group footer, and group caption. The GridAggregates component can be used to provide aggregate configurations.
In this demo, we showcase the display of the Email column as a hyperlink, facilitating its export to Excel and PDF files through the ExcelQueryCellInfoEvent and PdfQueryCellInfoEventevents.
Additionally, we utilized the GroupCaptionTemplate to showcase the group caption aggregation for the Freight column. To export the group caption template, use the ExcelGroupCaptionTemplateInfo and PdfGroupCaptionTemplateInfo events.
Grouping has been disabled for the Email and Freight columns.
For exporting custom group captions and footer templates, we utilize the ExcelAggregateTemplateInfo and PdfAggregateTemplateInfo events.
More information about the Exporting feature can be found in this documentation section.