-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIndex.razor
32 lines (28 loc) · 1.11 KB
/
Index.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@page "/"
@using GridDisabledCheckboxes.Data
@inject WeatherForecastService ForecastService
<DxGrid Data="@forecasts"
CssClass="mw-1100"
@bind-SelectedDataItems="@SelectedDataItems">
<Columns>
<DxGridSelectionColumn Width="70px" AllowSelectAll="false">
<CellDisplayTemplate>
@{
var item = (WeatherForecast)context.DataItem;
}
<DxCheckBox @bind-Checked="context.Selected" Enabled=@(item.Summary != "Mild") />
</CellDisplayTemplate>
</DxGridSelectionColumn>
<DxGridDataColumn Caption="Date" FieldName="Date" />
<DxGridDataColumn Caption="Temperature" FieldName="TemperatureF" />
<DxGridDataColumn Caption="Summary" FieldName="Summary" />
</Columns>
</DxGrid>
@code {
private WeatherForecast[]? forecasts;
IReadOnlyList<object> SelectedDataItems;
protected override async Task OnInitializedAsync() {
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
SelectedDataItems = forecasts.Where(f => f.Summary == "Warm").ToList();
}
}