Skip to content

Commit

Permalink
Load settings by Property/UniqueID improved
Browse files Browse the repository at this point in the history
  • Loading branch information
enchev committed Aug 10, 2023
1 parent 1a595c5 commit b673cbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Radzen.Blazor/RadzenDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2922,8 +2922,8 @@ internal async Task LoadSettings(DataGridSettings settings)
{
foreach (var column in settings.Columns.OrderBy(c => c.SortIndex))
{
var gridColumn = ColumnsCollection.Where(c => c.Property == column.Property).FirstOrDefault() ??
ColumnsCollection.Where(c => c.UniqueID == column.UniqueID).FirstOrDefault();
var gridColumn = ColumnsCollection.Where(c => !string.IsNullOrEmpty(column.Property) && c.Property == column.Property).FirstOrDefault() ??
ColumnsCollection.Where(c => !string.IsNullOrEmpty(column.UniqueID) && c.UniqueID == column.UniqueID).FirstOrDefault();
if (gridColumn != null)
{
// Sorting
Expand All @@ -2937,8 +2937,8 @@ internal async Task LoadSettings(DataGridSettings settings)

foreach (var column in settings.Columns)
{
var gridColumn = ColumnsCollection.Where(c => c.Property == column.Property).FirstOrDefault() ??
ColumnsCollection.Where(c => c.UniqueID == column.UniqueID).FirstOrDefault();
var gridColumn = ColumnsCollection.Where(c => !string.IsNullOrEmpty(column.Property) && c.Property == column.Property).FirstOrDefault() ??
ColumnsCollection.Where(c => !string.IsNullOrEmpty(column.UniqueID) && c.UniqueID == column.UniqueID).FirstOrDefault();
if (gridColumn != null)
{
// Visibility
Expand Down
2 changes: 1 addition & 1 deletion RadzenBlazorDemos/Pages/DataGridSaveSettings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
AllowColumnResize="true" AllowColumnReorder="true" ColumnWidth="200px"
FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" Data="@employees" TItem="Employee">
<Columns>
<RadzenDataGridColumn TItem="Employee" Title="Employee" Sortable="false" Filterable="false">
<RadzenDataGridColumn TItem="Employee" Title="Employee" Sortable="false" Filterable="false" UniqueID="Employee">
<Template Context="data">
<RadzenImage Path="@data.Photo" style="width: 40px; height: 40px; border-radius: 8px; margin-right: 8px;" />
@data.FirstName @data.LastName
Expand Down

0 comments on commit b673cbe

Please sign in to comment.