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 3ac026e commit 9924d77
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
<span class="comment"># create a new project and move to its directory</span>
dotnet new blazorwasm <span class="powershellParameter">-n</span> <span class="powershellCommand">my-container</span><span class="powershellParameter">-app</span>
cd <span class="powershellCommand">my-container</span><span class="powershellParameter">-app</span>
dotnet new blazorwasm <span class="powershellOperator">-</span>n my<span class="powershellOperator">-</span>container<span class="powershellOperator">-</span>app
cd my<span class="powershellOperator">-</span>container<span class="powershellOperator">-</span>app

<span class="comment"># add a reference to a (temporary) package that creates the container</span>
dotnet add package Microsoft.NET.Build.Containers
Expand All @@ -13,6 +13,6 @@

<span class="comment"># run your app using the new container</span>

docker run <span class="powershellParameter">-it</span> <span class="powershellOperator">--</span>rm 5010:80 <span class="powershellCommand">my-container</span><span class="powershellParameter">-app</span>:1.0:0
docker run <span class="powershellOperator">-</span>it <span class="powershellOperator">--</span>rm 5010:80 my<span class="powershellOperator">-</span>container<span class="powershellOperator">-</span>app:1.0:0
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
dotnet new blazorwasm <span class="powershellParameter">-n</span> BlazorWasmApp
dotnet new blazorwasm <span class="powershellOperator">-</span>n BlazorWasmApp
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
dotnet new blazorserver <span class="powershellParameter">-n</span> BlazorServerApp
dotnet new blazorserver <span class="powershellOperator">-</span>n BlazorServerApp
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
tailwindcss <span class="powershellParameter">-i</span> wwwroot<span class="powershellOperator">/</span>app.css <span class="powershellParameter">-o</span> wwwroot<span class="powershellOperator">/</span>app.min.css <span class="powershellParameter">-w</span>
tailwindcss <span class="powershellOperator">-</span>i wwwroot<span class="powershellOperator">/</span>app.css <span class="powershellOperator">-</span>o wwwroot<span class="powershellOperator">/</span>app.min.css <span class="powershellOperator">-</span>w
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
tailwindcss <span class="powershellParameter">-i</span> wwwroot<span class="powershellOperator">/</span>app.css <span class="powershellParameter">-o</span> wwwroot<span class="powershellOperator">/</span>app.min.css <span class="powershellParameter">-w</span>
tailwindcss <span class="powershellOperator">-</span>i wwwroot<span class="powershellOperator">/</span>app.css <span class="powershellOperator">-</span>o wwwroot<span class="powershellOperator">/</span>app.min.css <span class="powershellOperator">-</span>w
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
mkdir <span class="powershellParameter">-p</span> ~<span class="powershellOperator">/</span>.local<span class="powershellOperator">/</span>bin
wget https:<span class="powershellOperator">/</span><span class="powershellOperator">/</span>github.com<span class="powershellOperator">/</span>tailwindlabs<span class="powershellOperator">/</span>tailwindcss<span class="powershellOperator">/</span>releases<span class="powershellOperator">/</span>latest<span class="powershellOperator">/</span>download<span class="powershellOperator">/</span><span class="powershellCommand">tailwindcss-linux</span><span class="powershellParameter">-x64</span> <span class="powershellParameter">-O</span> ~<span class="powershellOperator">/</span>.local<span class="powershellOperator">/</span>bin<span class="powershellOperator">/</span>tailwindcss
mkdir <span class="powershellOperator">-</span>p ~<span class="powershellOperator">/</span>.local<span class="powershellOperator">/</span>bin
wget https:<span class="powershellOperator">/</span><span class="powershellOperator">/</span>github.com<span class="powershellOperator">/</span>tailwindlabs<span class="powershellOperator">/</span>tailwindcss<span class="powershellOperator">/</span>releases<span class="powershellOperator">/</span>latest<span class="powershellOperator">/</span>download<span class="powershellOperator">/</span>tailwindcss<span class="powershellOperator">-</span>linux<span class="powershellOperator">-</span>x64 <span class="powershellOperator">-</span>O ~<span class="powershellOperator">/</span>.local<span class="powershellOperator">/</span>bin<span class="powershellOperator">/</span>tailwindcss
chmod <span class="powershellOperator">+</span>x ~<span class="powershellOperator">/</span>.local<span class="powershellOperator">/</span>bin<span class="powershellOperator">/</span>tailwindcss
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
az containerapp registry set <span class="powershellOperator">--</span>name azurecontainerapptest3 <span class="powershellOperator">--</span><span class="powershellCommand">resource-group</span> testingRG <span class="powershellOperator">--</span>server ghcr.io <span class="powershellOperator">--</span>username <span class="powershellCommand">tesar-tech</span> <span class="powershellOperator">--</span>password ghp_yourpat
az containerapp registry set <span class="powershellOperator">--</span>name azurecontainerapptest3 <span class="powershellOperator">--</span>resource<span class="powershellOperator">-</span>group testingRG <span class="powershellOperator">--</span>server ghcr.io <span class="powershellOperator">--</span>username tesar<span class="powershellOperator">-</span>tech <span class="powershellOperator">--</span>password ghp_yourpat
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
dotnet new blazor <span class="powershellOperator">--</span>empty <span class="powershellParameter">-o</span> AzureContainerAppTest
dotnet new blazor <span class="powershellOperator">--</span>empty <span class="powershellOperator">-</span>o AzureContainerAppTest
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="blazorise-codeblock">
<div class="powershell"><pre>
az ad sp <span class="powershellCommand">create-for</span><span class="powershellParameter">-rbac</span> <span class="powershellOperator">--</span>name azurecontainerapptest3 <span class="powershellOperator">--</span>role contributor <span class="powershellOperator">--</span>scopes <span class="powershellOperator">/</span>subscriptions<span class="powershellOperator">/</span><span class="powershellOperator">--</span><span class="powershellCommand">your-subscription</span><span class="powershellParameter">-id</span><span class="powershellOperator">--</span><span class="powershellOperator">/</span>resourceGroups<span class="powershellOperator">/</span>testingRG<span class="powershellOperator">/</span>providers<span class="powershellOperator">/</span>Microsoft.App<span class="powershellOperator">/</span>containerApps<span class="powershellOperator">/</span>azurecontainerapptest3 <span class="powershellOperator">/</span>subscriptions<span class="powershellOperator">/</span><span class="powershellOperator">--</span><span class="powershellCommand">your-subscription</span><span class="powershellParameter">-id</span><span class="powershellOperator">--</span><span class="powershellOperator">/</span>resourceGroups<span class="powershellOperator">/</span>testingRG<span class="powershellOperator">/</span>providers<span class="powershellOperator">/</span>Microsoft.App<span class="powershellOperator">/</span>managedEnvironments<span class="powershellOperator">/</span>AzureContainerAppTest <span class="powershellOperator">--</span><span class="powershellCommand">json-auth</span>
az ad sp create<span class="powershellOperator">-</span><span class="keyword">for</span><span class="powershellOperator">-</span>rbac <span class="powershellOperator">--</span>name azurecontainerapptest3 <span class="powershellOperator">--</span>role contributor <span class="powershellOperator">--</span>scopes <span class="powershellOperator">/</span>subscriptions<span class="powershellOperator">/</span><span class="powershellOperator">--</span>your<span class="powershellOperator">-</span>subscription<span class="powershellOperator">-</span>id<span class="powershellOperator">--</span><span class="powershellOperator">/</span>resourceGroups<span class="powershellOperator">/</span>testingRG<span class="powershellOperator">/</span>providers<span class="powershellOperator">/</span>Microsoft.App<span class="powershellOperator">/</span>containerApps<span class="powershellOperator">/</span>azurecontainerapptest3 <span class="powershellOperator">/</span>subscriptions<span class="powershellOperator">/</span><span class="powershellOperator">--</span>your<span class="powershellOperator">-</span>subscription<span class="powershellOperator">-</span>id<span class="powershellOperator">--</span><span class="powershellOperator">/</span>resourceGroups<span class="powershellOperator">/</span>testingRG<span class="powershellOperator">/</span>providers<span class="powershellOperator">/</span>Microsoft.App<span class="powershellOperator">/</span>managedEnvironments<span class="powershellOperator">/</span>AzureContainerAppTest <span class="powershellOperator">--</span>json<span class="powershellOperator">-</span>auth
</pre></div>
</div>
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 9924d77

Please sign in to comment.