<SfGrid @ref="Grid" DataSource="@GridData" Toolbar="Toolbaritems">
<GridEvents OnToolbarClick="ToolbarClickHandler" OnActionComplete="ActionCompleteHandler" TValue="WeatherForecast"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Dialog" Dialog="DialogParams">
<Template>
@{
var wf = (context as WeatherForecast);
}
<div>
<div class="form-group col-md-12">
<SfDropDownList ID="Type" TValue="RecurrencePatternType" TItem="string" @bind-Value="@(wf.Type)" DataSource="@RecurrencePatternTypes" Placeholder="Type">
<DropDownListEvents TValue="RecurrencePatternType" TItem="string" ValueChange="onValueChange"></DropDownListEvents>
</SfDropDownList>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<SfTextBox ID="Summary" Disabled=@isDisabled @bind-Value="@(wf.Summary)" Placeholder="Summary"></SfTextBox>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<SfMultiSelect ID="Days" @bind-Value="@(wf.DaysOfWeek)" Disabled=@isDisabled TValue="List<System.DayOfWeek>" TItem="System.DayOfWeek" DataSource="@EnumValues" Mode="@VisualMode.Box" Placeholder="Select Day of Week"></SfMultiSelect>
</div>
</div>
</div>
</Template>
</GridEditSettings>
<GridColumns>
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> Grid { get; set; }
private bool isDisabled { get; set; } = false;
public List<Order> Orders { get; set; }
private void onValueChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<RecurrencePatternType, string> args)
{
this.isDisabled = args.Value != RecurrencePatternType.Weekly;
Grid.PreventRender(false);
} |