Skip to content

Commit

Permalink
DataGridSelectEdit | Always refresh selectItems if Data count has cha…
Browse files Browse the repository at this point in the history
…nged
  • Loading branch information
David-Moreira committed Nov 23, 2024
1 parent a40de9c commit 7bb257e
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#region Using directives
using System.Collections.Generic;
using System;
using System.Linq;
using System.Threading.Tasks;
using Blazorise.Modules;
using Microsoft.AspNetCore.Components;
using Blazorise.Extensions;
#endregion

namespace Blazorise.DataGrid;
Expand Down Expand Up @@ -39,8 +42,12 @@ public SelectItem( string text, object value, bool disabled )
protected override void OnInitialized()
{
elementId = IdGenerator.Generate;
base.OnInitialized();
}

if ( Column.Data is not null )
protected override void OnParametersSet()
{
if ( Column?.Data is not null && selectItems?.Count != Column.Data.Count() )
{
selectItems = new();
foreach ( var item in Column.Data )
Expand All @@ -51,8 +58,7 @@ protected override void OnInitialized()
selectItems.Add( new( text, value, disabled ) );
}
}

base.OnInitialized();
base.OnParametersSet();
}

private void OnSelectedValueChanged( object value )
Expand Down

0 comments on commit 7bb257e

Please sign in to comment.