GridRow - SwitchButton handle

pull/13/head
markosteger 2 years ago
parent f770bd26bc
commit 5a4c13f8ad

@ -1,8 +1,8 @@
<CascadingValue Value="this"> <CascadingValue Value="this">
<div class="@GridRowClass"> <div class="@GridRowClass" id="@Guid.NewGuid()">
<div class="data-grid-select" > <div class="data-grid-select" >
<label class="toggle-group m-0" for="toggle-s11"> <label class="toggle-group m-0" for="@SwitchButtonId">
<input class="toggle-input" id="toggle-s11" name="toggle" type="checkbox"> <input class="toggle-input" id="@SwitchButtonId" name="toggle" type="checkbox" @onchange="(args=>SwitchButtonChange(args))">
<div class="toggle-fill"></div> <div class="toggle-fill"></div>
</label> </label>
</div> </div>

@ -38,6 +38,16 @@ public partial class GridRow : ComponentBase
} }
} }
[Parameter]
public EventCallback<ChangeEventArgs> SwitchButtonChangeEvent { get; set; }
private async Task SwitchButtonChange(ChangeEventArgs args)
{
await SwitchButtonChangeEvent.InvokeAsync(args);
}
private string SwitchButtonId = Guid.NewGuid().ToString();
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
if (Parent.Rows is null) Parent.Rows = new(); if (Parent.Rows is null) Parent.Rows = new();

Loading…
Cancel
Save