Hi Scott,Greetings from Syncfusion support.We have looked into your query on ListView and TreeGrid component. For your information, EJ2 ListView component is light weight component which is developed to bound data sources to have minimum node hierarchy, so self-referencing support is not available in it.But, EJ2 TreeGrid component large component which developed to bound more complex data source to handle complex node level hierarchy, and self-referencing support is available in it.However, we are validating the feasibility for achieving your requirement in ListView. So, we will update you the further details on this regard in two business days on 27 January 2020.We appreciate your patience until, then.Regards,Shameer Ali Baig S.
@using Microsoft.AspNetCore.Http
@inject IHttpContextAccessor httpContextAccessor
@using Syncfusion.EJ2.Blazor.Grids
@using Syncfusion.EJ2.Blazor.TreeGrid
<EjsTreeGrid IdMapping="TaskId" DataSource="@TreeGridData" ParentIdMapping="ParentId"TreeColumnIndex="1" AllowFiltering="true" Toolbar="@toolbar">
<TreeGridColumns>
<TreeGridColumn Field="TaskId" HeaderText="Task ID" Width="80"TextAlign="Syncfusion.EJ2.Blazor.Grids.TextAlign.Right"></TreeGridColumn>
<TreeGridColumn Field="TaskName" HeaderText="Task Name" Width="100"></TreeGridColumn>
<TreeGridColumn Field="Duration" HeaderText="Duration" Width="100"TextAlign="Syncfusion.EJ2.Blazor.Grids.TextAlign.Right"></TreeGridColumn>
<TreeGridColumn Field="Progress" HeaderText="Progress" Width="100"TextAlign="Syncfusion.EJ2.Blazor.Grids.TextAlign.Right"></TreeGridColumn>
<TreeGridColumn Field="Priority" HeaderText="Priority" Width="60"></TreeGridColumn>
</TreeGridColumns>
</EjsTreeGrid>
@code{
public List<TreeData> TreeGridData { get; set; }
public string Name { get; set; } = "parent";
public int Duration { get; set; } = 5;
public List<string> toolbar { get; set; } = null;
protected override void OnInitialized()
{
string useragent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"].ToString();
if (!useragent.Contains("Mobile"))
{
toolbar = new List<string>() { "Search" };
}
this.TreeGridData = TreeData.GetSelfDataSource().ToList();
}
public class TreeData
{
public int TaskId { get; set; }
public string TaskName { get; set; }
public int? Duration { get; set; }
public int? Progress { get; set; }
public string Priority { get; set; }
public int? ParentId { get; set; }
public static List<TreeData> GetSelfDataSource()
{
List<TreeData> BusinessObjectCollection = new List<TreeData>();
BusinessObjectCollection.Add(new TreeData() { TaskId = 1, TaskName = "Parent Task 1", Duration = 10, Progress = 70, Priority = "Critical", ParentId = null });
-------
return BusinessObjectCollection;
}
}
} |
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddHttpContextAccessor();
services.AddSyncfusionBlazor();
services.AddSingleton<WeatherForecastService>();
} |