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