From 9924d772d873ab73dc7b47428abcd6b07b5b0735 Mon Sep 17 00:00:00 2001 From: David Moreira Date: Sat, 23 Nov 2024 11:30:55 +0000 Subject: [PATCH] DataGridSelectEdit | Always refresh selectItems if Data count has changed --- .../Code/WhatToExpectInNet76Code.html | 6 +++--- .../Code/SettingUpABlazorProject1Code.html | 2 +- .../Code/SettingUpABlazorProject2Code.html | 2 +- .../BlazorAndTailwindQuickSetupWithoutNpm11Code.html | 2 +- .../BlazorAndTailwindQuickSetupWithoutNpm15Code.html | 2 +- .../BlazorAndTailwindQuickSetupWithoutNpm6Code.html | 4 ++-- ...ontainerAppWithGitHubContainerRegistry10Code.html | 2 +- ...ContainerAppWithGitHubContainerRegistry1Code.html | 2 +- ...ContainerAppWithGitHubContainerRegistry7Code.html | 2 +- .../_DataGridCellSelectEdit.razor.cs | 12 +++++++++--- 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2022-08-29_WhatToExpectInNet7/Code/WhatToExpectInNet76Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2022-08-29_WhatToExpectInNet7/Code/WhatToExpectInNet76Code.html index 8888b56b49..46e485fd4b 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2022-08-29_WhatToExpectInNet7/Code/WhatToExpectInNet76Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2022-08-29_WhatToExpectInNet7/Code/WhatToExpectInNet76Code.html @@ -1,8 +1,8 @@
 # create a new project and move to its directory
-dotnet new blazorwasm -n my-container-app
-cd my-container-app
+dotnet new blazorwasm -n my-container-app
+cd my-container-app
 
 # add a reference to a (temporary) package that creates the container
 dotnet add package Microsoft.NET.Build.Containers
@@ -13,6 +13,6 @@
 
 # run your app using the new container
 
-docker run -it --rm 5010:80 my-container-app:1.0:0
+docker run -it --rm 5010:80 my-container-app:1.0:0
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject1Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject1Code.html index 74cca7cb35..f1338f855e 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject1Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject1Code.html @@ -1,5 +1,5 @@
-dotnet new blazorwasm -n BlazorWasmApp
+dotnet new blazorwasm -n BlazorWasmApp
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject2Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject2Code.html index 1739e9bad9..6d4be118fb 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject2Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2022-09-19_SettingUpABlazorProject/Code/SettingUpABlazorProject2Code.html @@ -1,5 +1,5 @@
-dotnet new blazorserver -n BlazorServerApp
+dotnet new blazorserver -n BlazorServerApp
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm11Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm11Code.html index 20751310fc..c4e00a96b9 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm11Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm11Code.html @@ -1,5 +1,5 @@
-tailwindcss -i wwwroot/app.css -o wwwroot/app.min.css -w
+tailwindcss -i wwwroot/app.css -o wwwroot/app.min.css -w
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm15Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm15Code.html index 20751310fc..c4e00a96b9 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm15Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm15Code.html @@ -1,5 +1,5 @@
-tailwindcss -i wwwroot/app.css -o wwwroot/app.min.css -w
+tailwindcss -i wwwroot/app.css -o wwwroot/app.min.css -w
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm6Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm6Code.html index 348448cd04..5badb1f15f 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm6Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2024-08-18_BlazorAndTailwindQuickSetupWithoutNpm/Code/BlazorAndTailwindQuickSetupWithoutNpm6Code.html @@ -1,7 +1,7 @@
-mkdir -p ~/.local/bin
-wget https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -O ~/.local/bin/tailwindcss
+mkdir -p ~/.local/bin
+wget https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -O ~/.local/bin/tailwindcss
 chmod +x ~/.local/bin/tailwindcss
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry10Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry10Code.html index 07c03e9b0c..fe595f8d72 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry10Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry10Code.html @@ -1,5 +1,5 @@
-az containerapp registry set --name azurecontainerapptest3 --resource-group testingRG --server ghcr.io --username tesar-tech --password ghp_yourpat
+az containerapp registry set --name azurecontainerapptest3 --resource-group testingRG --server ghcr.io --username tesar-tech --password ghp_yourpat
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry1Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry1Code.html index c52473f8a2..7843f335fa 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry1Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry1Code.html @@ -1,5 +1,5 @@
-dotnet new blazor --empty -o AzureContainerAppTest
+dotnet new blazor --empty -o AzureContainerAppTest
 
diff --git a/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry7Code.html b/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry7Code.html index 63990d3945..79d6ce8da5 100644 --- a/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry7Code.html +++ b/Documentation/Blazorise.Docs/Pages/Blog/2024-10-16_BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry/Code/BlazorAppAsAnAzureContainerAppWithGitHubContainerRegistry7Code.html @@ -1,5 +1,5 @@
-az ad sp create-for-rbac --name azurecontainerapptest3 --role contributor --scopes /subscriptions/--your-subscription-id--/resourceGroups/testingRG/providers/Microsoft.App/containerApps/azurecontainerapptest3 /subscriptions/--your-subscription-id--/resourceGroups/testingRG/providers/Microsoft.App/managedEnvironments/AzureContainerAppTest --json-auth
+az ad sp create-for-rbac --name azurecontainerapptest3 --role contributor --scopes /subscriptions/--your-subscription-id--/resourceGroups/testingRG/providers/Microsoft.App/containerApps/azurecontainerapptest3 /subscriptions/--your-subscription-id--/resourceGroups/testingRG/providers/Microsoft.App/managedEnvironments/AzureContainerAppTest --json-auth
 
diff --git a/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs b/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs index 698032a4f2..e4ab7780c7 100644 --- a/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs +++ b/Source/Extensions/Blazorise.DataGrid/_DataGridCellSelectEdit.razor.cs @@ -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; @@ -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 ) @@ -51,8 +58,7 @@ protected override void OnInitialized() selectItems.Add( new( text, value, disabled ) ); } } - - base.OnInitialized(); + base.OnParametersSet(); } private void OnSelectedValueChanged( object value )