TreeGrid Self Referencing not working

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; }

    }

5 Replies

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team April 9, 2020 12:25 PM UTC

Hi Yazeed, 

Thanks for contacting Syncfusion Support. 

We have checked your query and we have prepared sample as per your code example but we are unable to reproduce the problem at our end. Refer to the sample link below, 

Refer to the screenshot:- 
 

Note:- We need to define hasChildMapping property to determine whether record is parent or not only on remote data binding.  

We need some more additional details to find the cause of the issue. Share us the following details. 

  1. Share product version detail.
  2. If possible replicate the issue in the above sample and revert us back.

Regards, 
Farveen sulthana T 



YA Yazeed April 9, 2020 01:30 PM UTC

Thank you for your reply, i cannot download the file, it says Access Denied.


MP Manivannan Padmanaban Syncfusion Team April 10, 2020 05:36 AM UTC

Hi Yazeed, 

Sorry for the inconvenience caused. 

Please refer to the below link for sample, 

Regards, 
Manivannan Padmanaban 



WI Willem February 25, 2021 12:13 PM UTC

I'm running into the same issue. The first load the treeview loads perfectly, but when I try to change the source by assigning a new list the TreeView doesn't update/refresh.

I've tried the example codes and that works perfectly, but the examples I get does not use the HasChildren and ParentID parameters.




FS Farveen Sulthana Thameeztheen Basha Syncfusion Team February 26, 2021 04:39 PM UTC

Hi Willem,  
 
Thanks for contacting Syncfusion Support. 

Query#:- The first load the treeview loads perfectly, but when I try to change the source by assigning a new list the TreeView doesn't update/refresh. 

We are unable to replicate your reported problem at our end. We have prepared sample(changing dataSource with button Click) it has been refreshed properly. 


Screenshot:- 
 
We need some more additional details to find the cause of the issue. Share us the following details. 

  1. Complete TreeGrid code example.
  2. Screenshot/Video Demo to replicate the issue.
  3. If possible replicate it in the above sample and revert us back.
  4. Syncfusion Package version details.
  5. Have you used Hierarchical binding or Self-reference data for binding data
  6. How you have changed the source of the TreeGrid(using buttonClick or any other)

Regards, 
Farveen sulthana T 


Loader.
Up arrow icon