Add a FooterTemplate to the RadzenDataGrid component to match the useful HeaderTemplate #1094

Closed
opened 2026-01-29 17:48:49 +00:00 by claunia · 1 comment
Owner

Originally created by @djatkinsrealis on GitHub (Jan 14, 2024).

RadzenDataGrid has a useful custom header provision, using the HeaderTemplate value. I find I also need to add custom footer displays, that become part of the DataGrid, rather than tacked on afterwards in a parent component (always feels cleaner to compose components where suitable).

In combination with my other feature request (to cascade the RadzenDataGrid class to its entire component hierarchy), this will allow the clean addition of components which can reference the cascaded RadzenDataGrid component without external links.

e.g. add this property after HeaderTemplate:

    /// <summary>
    /// Gives the grid a custom footer, allowing the adding of components to create custom tool bars or custom pagination
    /// </summary>
    [Parameter]
    public RenderFragment FooterTemplate { get; set; }

and implement at the bottom of RadzenDataGrid after the Pagination(?):

        @if (AllowPaging && (PagerPosition.HasFlag(PagerPosition.Bottom)))
        {
            <RadzenPager HorizontalAlign="@PagerHorizontalAlign" AlwaysVisible="@PagerAlwaysVisible" @ref="bottomPager" Count="@Count" PageSize="@PageSize" PageNumbersCount="@PageNumbersCount" PageChanged="@ChangePage" PageSizeChanged="@OnPageSizeChanged" PageSizeOptions="@PageSizeOptions" ShowPagingSummary="@ShowPagingSummary" PagingSummaryFormat="@PagingSummaryFormat" PageSizeText="@PageSizeText" Density="@Density" FirstPageTitle="@FirstPageTitle" FirstPageAriaLabel="@FirstPageAriaLabel" PrevPageAriaLabel="@PrevPageAriaLabel" PrevPageTitle="@PrevPageTitle" NextPageAriaLabel="@NextPageAriaLabel" NextPageTitle="@NextPageTitle" LastPageAriaLabel="@LastPageAriaLabel" LastPageTitle="@LastPageTitle" PageAriaLabelFormat="@PageAriaLabelFormat" PageTitleFormat="@PageTitleFormat" />
        }
        @if (@FooterTemplate != null)
        {
            <div class="rz-custom-footer">
                @FooterTemplate
            </div>
        }
    </div>
Originally created by @djatkinsrealis on GitHub (Jan 14, 2024). RadzenDataGrid has a useful custom header provision, using the `HeaderTemplate` value. I find I also need to add custom footer displays, that become part of the DataGrid, rather than tacked on afterwards in a parent component (always feels cleaner to compose components where suitable). In combination with my other feature request (to cascade the RadzenDataGrid class to its entire component hierarchy), this will allow the clean addition of components which can reference the cascaded RadzenDataGrid component without external links. e.g. add this property after HeaderTemplate: /// <summary> /// Gives the grid a custom footer, allowing the adding of components to create custom tool bars or custom pagination /// </summary> [Parameter] public RenderFragment FooterTemplate { get; set; } and implement at the bottom of RadzenDataGrid after the Pagination(?): @if (AllowPaging && (PagerPosition.HasFlag(PagerPosition.Bottom))) { <RadzenPager HorizontalAlign="@PagerHorizontalAlign" AlwaysVisible="@PagerAlwaysVisible" @ref="bottomPager" Count="@Count" PageSize="@PageSize" PageNumbersCount="@PageNumbersCount" PageChanged="@ChangePage" PageSizeChanged="@OnPageSizeChanged" PageSizeOptions="@PageSizeOptions" ShowPagingSummary="@ShowPagingSummary" PagingSummaryFormat="@PagingSummaryFormat" PageSizeText="@PageSizeText" Density="@Density" FirstPageTitle="@FirstPageTitle" FirstPageAriaLabel="@FirstPageAriaLabel" PrevPageAriaLabel="@PrevPageAriaLabel" PrevPageTitle="@PrevPageTitle" NextPageAriaLabel="@NextPageAriaLabel" NextPageTitle="@NextPageTitle" LastPageAriaLabel="@LastPageAriaLabel" LastPageTitle="@LastPageTitle" PageAriaLabelFormat="@PageAriaLabelFormat" PageTitleFormat="@PageTitleFormat" /> } @if (@FooterTemplate != null) { <div class="rz-custom-footer"> @FooterTemplate </div> } </div>
Author
Owner

@enchev commented on GitHub (Jan 14, 2024):

We accept pull requests!

@enchev commented on GitHub (Jan 14, 2024): We accept pull requests!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1094