Issue when adding row after child element

Hi, 

I have a problem with the threegrid.

this is my example code:

<SfTreeGrid DataSource="@GridItems" IdMapping="Id" ParentIdMapping="ParentID" TreeColumnIndex="0" AllowRowDragAndDrop="true" AllowSelection="true">

    <TreeGridColumns>

        <TreeGridColumn Field="@nameof(GridItem.ParentID)" HeaderText="ParentID" Width="20"></TreeGridColumn>

        <TreeGridColumn Field="@nameof(GridItem.Id)" HeaderText="ID" Width="20" IsPrimaryKey="true" Visible="true"></TreeGridColumn>

    </TreeGridColumns>

</SfTreeGrid>

<SfButton OnClick="Add">Add</SfButton>


public ObservableCollection<GridItem> GridItems = [];

    private void Add()

    {

        GridItem newItem = new();

        newItem.Id = GridItems.Count;


        GridItems.Add(newItem);

    }


    public class GridItem

    {

        public int Id { get; set; }

        public int? ParentID { get; set; }

    }


Now you can do the following steps to reproduce the problem:
- push twotimes the Add button.

- drag the last Entry onto the other item, now we have one parent item with one child item

- push the add button again

now the child item in the grid disapears and instead the new item is shown, but the parent item still have the small expand arrow. If you check the underlying collection, there everything is correct, so I think there must be something wrong inside the gridtree component.

This error did not happen, if the parent item have more than one child item.


I hope you can find something or tell me if I am doning something wrong.


Regards,

Alex


2 Replies

AK Alexander Kuhlmann October 23, 2024 10:54 AM UTC

After updating to the newest version, everything wokrs fine.



PS Pon Selva Jeganathan Syncfusion Team October 23, 2024 01:57 PM UTC

Hi Alexander,


We are delighted to hear that your issue has been resolved after upgrading to the latest version. If you encounter any further issues following the upgrade, please don’t hesitate to reach out to us. We are always here to assist you.


Regards,
Pon Selva



Loader.
Up arrow icon