Hello,
i started to test Tree Grid with asp.net Core Razor Pages and i'm not sure why Self Referencing data binding is not working, if ParentId is not set (equals to 0) then the whole row wont appear, if i set ParentId to the same Id (TaskId property) then the grid will not render them as tree, this example below doesn't set ParentId on root nodes but set it on one child node, only child node is rendered.
here is the code:
cshtml.cs : (Tags removed because they disappear when posting here)
ejs-treegrid id="TreeGrid"
dataSource="Model.Tasks"
idMapping="TaskId"
parentIdMapping="ParentId"
hasChildMapping="HasChildren"
treeColumnIndex="1"
allowPaging="true"
e-treegrid-columns
e-treegrid-column field="TaskId" headerText="Task ID" textAlign="Right" width="90"
e-treegrid-column field="TaskName" headerText="Task Name" width="180"
Code behind:
[BindProperty]
public List Tasks { get; set; }
public void OnGet()
{
Tasks = new List()
{
new Task { TaskId = 1, TaskName = "Test" , HasChildren= true},
new Task { TaskId = 2, TaskName = "Test2", HasChildren= false},
new Task { TaskId = 3, TaskName = "Test3", HasChildren= false, ParentId = 1 }
};
}
public class Task
{
public int TaskId { get; set; }
public string TaskName { get; set; }
public int ParentId { get; set; }
public bool HasChildren { get; set; }
}