DxTreeList.GetDataColumns() Method
Returns a data column collection.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public IReadOnlyList<ITreeListDataColumn> GetDataColumns()
Returns
Type | Description |
---|---|
IReadOnlyList<ITreeListDataColumn> | The data column collection. |
Remarks
Call the GetDataColumns
method to get a collection of data columns declared in the TreeList’s markup. To obtain a collection of all TreeList columns, call the GetColumns() method.
@inject EmployeeTaskService EmployeeTaskService
<style>
.my-button{
width: 150px;
margin-bottom: 5px;
margin-top: 5px;
}
</style>
<DxTreeList @ref="@TreeList"
Data="TreeListData"
KeyFieldName="Id"
ParentKeyFieldName="ParentId"
@bind-SelectedDataItems="@SelectedDataItems">
<Columns>
<DxTreeListDataColumn FieldName="EmployeeName" VisibleIndex="2" />
<DxTreeListDataColumn FieldName="Name" VisibleIndex="1" />
<DxTreeListDataColumn FieldName="StartDate" />
<DxTreeListDataColumn FieldName="DueDate" />
<DxTreeListSelectionColumn VisibleIndex="0" Width="50"/>
</Columns>
</DxTreeList>
<DxButton Click="@OnGetDataColumns" Text="Get Data Columns" CssClass="my-button" />
<div><b>Data Columns</b>: @ColumnInfo</div>
@code {
List<EmployeeTask> TreeListData { get; set; }
ITreeList TreeList { get; set; }
string ColumnInfo { get; set; }
IReadOnlyList<object> SelectedDataItems { get; set; }
protected override void OnInitialized() {
TreeListData = EmployeeTaskService.GenerateData();
}
void OnGetDataColumns() {
var columns = TreeList.GetDataColumns().Select(
(column) => (column as ITreeListDataColumn).FieldName
);
ColumnInfo = string.Join("; ", columns);
}
}
Implements
See Also