TreeListSelectionColumnHeaderTemplateContext.SelectAllEnabled Property
Determines if the Select All operation is available.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public bool SelectAllEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Remarks
A selection column contains a checkbox in the header cell if the column’s AllowSelectAll option is enabled. You can define the column’s HeaderTemplate to display custom select elements in the header.
The Select All operation can be temporarily unavailable if you bind the TreeList to the GridDevExtremeDataSource or load data on demand. The SelectAllEnabled
context parameter returns false
while the Select All operation cannot be performed. Once this operation becomes available, this parameter returns true
.
In the template, use the SelectAllEnabled
parameter to specify the enabled or disabled state for a custom select element. In the same way, you can use the SelectEnabled parameter in the selection column’s CellDisplayTemplate.
@inject CitiesService CitiesService
<DxTreeList Data="@Data"
KeyFieldName="ID"
ParentKeyFieldName="ParentID"
HasChildrenFieldName="HasChildren"
@bind-SelectedDataItems="@SelectedDataItems">
<Columns>
<DxTreeListSelectionColumn>
<HeaderTemplate>
<DxButton Click="() => context.TreeList.SelectAllOnPage()" Text="Select All"
RenderStyle="ButtonRenderStyle.Link"
Enabled="context.SelectAllEnabled" />
</HeaderTemplate>
</DxTreeListSelectionColumn>
<DxTreeListDataColumn Caption="Location" FieldName="Name" />
<DxTreeListDataColumn FieldName="CityType" />
<DxTreeListDataColumn FieldName="Year" DisplayFormat="d" />
<DxTreeListDataColumn FieldName="RecordType" />
<DxTreeListDataColumn FieldName="Population" />
</Columns>
</DxTreeList>
@code {
object Data { get; set; }
IReadOnlyList<object> SelectedDataItems { get; set; }
protected override async Task OnInitializedAsync() {
var cities = await CitiesService.GetCitiesAsync();
Data = new GridDevExtremeDataSource<Location>(cities.AsQueryable());
}
}