Problem with Expanded event handler

Hi,

This is one of your examples where I have just added an Expanded event handler. 
What I don't understand is that its presence causes the whole treegrid to expand when I just want to expand one element.
Hope I made myself clear. 
Thanks for you help. Code follows:

@page  "/treeExpandSyncfusion"
 
@using Syncfusion.EJ2.Blazor.TreeGrid

<h3>TreeExpandSyncfusion</h3>



<EjsTreeGrid DataSource="@TreeData" IdMapping="TaskId" ParentIdMapping="ParentId" TreeColumnIndex="1" EnableCollapseAll="true">
    <TreeGridEvents TValue="BusinessObject" Expanded="OnRowExpanded"></TreeGridEvents>
    <TreeGridColumns>
        <TreeGridColumn Field="TaskId" HeaderText="Task ID" Width="80" TextAlign="Syncfusion.EJ2.Blazor.Grids.TextAlign.Right"></TreeGridColumn>
        <TreeGridColumn Field="TaskName" HeaderText="Task Name" Width="160"></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>
    </TreeGridColumns>
</EjsTreeGrid>

@code{
    public class BusinessObject
    {
        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 List<BusinessObject> TreeData = new List<BusinessObject>();

    protected override void OnInitialized()
    {
        TreeData.Add(new BusinessObject() { TaskId = 1, TaskName = "Parent Task 1", Duration = 10, Progress = 70, ParentId = null, Priority = "High" });
        TreeData.Add(new BusinessObject() { TaskId = 2, TaskName = "Child task 1", Duration = 4, Progress = 80, ParentId = 1, Priority = "Normal" });
        TreeData.Add(new BusinessObject() { TaskId = 3, TaskName = "Child Task 2", Duration = 5, Progress = 65, ParentId = 1, Priority = "Critical" });
        TreeData.Add(new BusinessObject() { TaskId = 4, TaskName = "Parent Task 2", Duration = 6, Progress = 77, ParentId = null, Priority = "Low" });
        TreeData.Add(new BusinessObject() { TaskId = 5, TaskName = "Child Task 5", Duration = 9, Progress = 25, ParentId = 4, Priority = "Normal" });
        TreeData.Add(new BusinessObject() { TaskId = 6, TaskName = "Child Task 6", Duration = 9, Progress = 7, ParentId = 5, Priority = "Normal" });
        TreeData.Add(new BusinessObject() { TaskId = 7, TaskName = "Parent Task 3", Duration = 4, Progress = 45, ParentId = null, Priority = "High" });
        TreeData.Add(new BusinessObject() { TaskId = 8, TaskName = "Child Task 7", Duration = 3, Progress = 38, ParentId = 7, Priority = "Critical" });
        TreeData.Add(new BusinessObject() { TaskId = 9, TaskName = "Child Task 8", Duration = 7, Progress = 70, ParentId = 7, Priority = "Low" });
    }

    private void OnRowExpanded(Syncfusion.EJ2.Blazor.TreeGrid.RowExpandedEventArgs<BusinessObject> e)
    {
        //Description1 = e.Data.TaskName.ToString();
    }
}

1 Reply

GL Gowri Loganathan Syncfusion Team March 26, 2020 08:41 AM UTC

Hi Ridha, 

Thanks for contacting Syncfusion Forum 

Query : I have just added an Expanded event handler. What I don't understand is that its presence causes the whole treegrid to expand when I just want to expand one element. 

From the shared code snippet we have prepared a sample but we are unable to reproduce the reported issue at our end. When we try to expand the row , the target row only get expanded while others are in collapsed state only. 

Kindly refer the below sample (version : 17.4.0.49) 
 
Please refer the video demo 


After referred the above sample still facing an issue, please get back to us with the below details which will be more helpful for us to proceed further on this 
  1. Share your Essential Studio Version
  2. Share us the video / screenshot to demonstrate the issue
  3. If possible reproduce the issue in the attached sample


Regards, 
Gowri V L. 


Loader.
Up arrow icon