<TelerikTreeList Data="@TreeListData" IdField="@nameof(SampleModel.Id)"
ParentIdField="@nameof(SampleModel.ParentId)"
Pageable="true"
Sortable="true">
<TreeListColumns><TreeListColumnField="@nameof(SampleModel.Id)" /><TreeListColumnField="@nameof(SampleModel.ParentId)" /><TreeListColumnField="@nameof(SampleModel.Name)"Expandable="true" /></TreeListColumns>
</TelerikTreeList>
@code {
private List<SampleModel> TreeListData { get; set; } = new();
private List<string> SearchableFields = new List<string> { nameof(SampleModel.Name) };
protected override voidOnInitialized()
{
for (int i = 1; i <= 9; i++)
{
TreeListData.Add(newSampleModel()
{
Name = $"Name {i}"
});
}
for (int i = 0; i < TreeListData.Count; i++)
{
if (i > 2)
{
TreeListData[i].ParentId = TreeListData[i % 3].Id;
}
}
}
public classSampleModel{
public string Id { get; set; } = Guid.NewGuid().ToString();
public string? ParentId { get; set; }
public string Name { get; set; } = string.Empty;
}
}
Regards,
Dimo
Progress Telerik
Do you have a stake in the designеr-developer collaboration process? If so, take our survey to share your perspective and become part of this global research. You’ll be among the first to know once the results are out. -> Start The State of Designer-Developer Collaboration Survey 2024