diff --git a/Radzen.Blazor/RadzenDropDownDataGrid.razor b/Radzen.Blazor/RadzenDropDownDataGrid.razor index 99a11b0cf..c1628d327 100644 --- a/Radzen.Blazor/RadzenDropDownDataGrid.razor +++ b/Radzen.Blazor/RadzenDropDownDataGrid.razor @@ -141,7 +141,7 @@ } @if (Template != null) { - @@ -156,7 +156,7 @@ { if (!string.IsNullOrEmpty(TextProperty) || Columns != null) { - @if (Columns != null) @@ -172,7 +172,7 @@ } else { - diff --git a/Radzen.Blazor/RadzenDropDownDataGrid.razor.cs b/Radzen.Blazor/RadzenDropDownDataGrid.razor.cs index db6c71b65..986dcccdd 100644 --- a/Radzen.Blazor/RadzenDropDownDataGrid.razor.cs +++ b/Radzen.Blazor/RadzenDropDownDataGrid.razor.cs @@ -42,6 +42,13 @@ namespace Radzen.Blazor [Parameter] public Action> CellRender { get; set; } + /// + /// Gets or sets the footer template. + /// + /// The footer template. + [Parameter] + public RenderFragment FooterTemplate { get; set; } + /// /// Gets or sets a value indicating whether the selected items will be displayed as chips. Set to false by default. /// Requires to be set to true. diff --git a/RadzenBlazorDemos/Pages/DropDownDataGridConfig.razor b/RadzenBlazorDemos/Pages/DropDownDataGridConfig.razor deleted file mode 100644 index 39154a6a9..000000000 --- a/RadzenBlazorDemos/Pages/DropDownDataGridConfig.razor +++ /dev/null @@ -1,199 +0,0 @@ -@using System.Linq.Dynamic.Core -@using RadzenBlazorDemos.Data -@using RadzenBlazorDemos.Models.Northwind - -@inherits DbContextPage - - - - - - Binding to simple collection - c.CompanyName).Distinct().AsQueryable()) - Change=@(args => OnChange(args, "DropDownDataGrid")) Style="width: 100%"/> - - - - - Filtering by all string columns - OnChange(args, "DropDownDataGrid with filtering by all string columns"))> - - - - - - - - - - - - Filter operator - OnChange(args, "DropDownDataGrid with custom filter operator")) Style="width: 100%"/> - - - - - Custom filtering - OnChange(args, "DropDownDataGrid with custom filtering")) Style="width: 100%"/> - - - - - Multiple selection -
- - -
- OnChange(args, "DropDownDataGrid with multiple selection")) Style="width: 100%"> - - - - - - - - - - - - - -
-
- - - Custom template - OnChange(args, "DropDownDataGrid with placeholder")) Style="width: 100%"> - - - - - - - Virtualization using IQueryable - OnChange(args, "DropDownDataGrid with virtualization using IQueryable")) Style="width: 100%"> - - - - - - - - - - Virtualization using LoadData event - OnChange(args, "DropDownDataGrid with virtualization using LoadData event")) Style="width: 100%"/> - - -
- - - -@code { - bool allowRowSelectOnRowClick = true; - RadzenDropDownDataGrid> grid; - IEnumerable customers; - - IEnumerable multipleValues = new string[] { "ALFKI", "AROUT" }; - string value; - string simpleValue = "Around the Horn"; - - int count; - IEnumerable customCustomersData; - - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - - customers = dbContext.Customers.ToList(); - } - - EventConsole console; - - void OnChange(object value, string name) - { - var str = value is IEnumerable ? string.Join(", ", (IEnumerable)value) : value; - - console.Log($"{name} value changed to {str}"); - } - - void LoadData(LoadDataArgs args) - { - var query = dbContext.Customers.AsQueryable(); - - if (!string.IsNullOrEmpty(args.Filter)) - { - query = query.Where(c => c.CustomerID.Contains(args.Filter) || c.ContactName.Contains(args.Filter)); - } - - count = query.Count(); - - if (!string.IsNullOrEmpty(args.OrderBy)) - { - query = query.OrderBy(args.OrderBy); - } - - if (args.Skip != null) - { - query = query.Skip(args.Skip.Value); - } - - if (args.Top != null) - { - query = query.Take(args.Top.Value); - } - - customCustomersData = query; - - InvokeAsync(StateHasChanged); - } - - int customCustomersDataVirtualizationCount; - IEnumerable customCustomersDataVirtualization; - - void LoadDataVirtualization(LoadDataArgs args) - { - var query = dbContext.Customers.AsQueryable(); - - if (!string.IsNullOrEmpty(args.Filter)) - { - query = query.Where(c => c.CustomerID.ToLower().Contains(args.Filter.ToLower()) || c.ContactName.ToLower().Contains(args.Filter.ToLower())); - } - - if (!string.IsNullOrEmpty(args.OrderBy)) - { - query = query.OrderBy(args.OrderBy); - } - - console.Log($"LoadData with virtualization: Skip:{args.Skip}, Top:{args.Top}, OrderBy:{args.OrderBy}, Filter:{args.Filter}"); - - customCustomersDataVirtualizationCount = query.Count(); - - customCustomersDataVirtualization = query.Skip(args.Skip.Value).Take(args.Top.Value).ToList(); - - InvokeAsync(StateHasChanged); - } -} diff --git a/RadzenBlazorDemos/Pages/DropDownDataGridPage.razor b/RadzenBlazorDemos/Pages/DropDownDataGridPage.razor index 3342e8a26..c7f9cb2ab 100644 --- a/RadzenBlazorDemos/Pages/DropDownDataGridPage.razor +++ b/RadzenBlazorDemos/Pages/DropDownDataGridPage.razor @@ -35,7 +35,7 @@ - DropDownDataGrid with template + DropDownDataGrid with custom header, footer, value and item templates diff --git a/RadzenBlazorDemos/Pages/DropDownDataGridTemplate.razor b/RadzenBlazorDemos/Pages/DropDownDataGridTemplate.razor index 935997c68..2ee0a4bdb 100644 --- a/RadzenBlazorDemos/Pages/DropDownDataGridTemplate.razor +++ b/RadzenBlazorDemos/Pages/DropDownDataGridTemplate.razor @@ -5,12 +5,18 @@ + + Custom header + Company: @((context as Customer).CompanyName) + + Custom footer +