Completed
Last Updated: 15 Feb 2021 10:40 by ADMIN
Release R1 2021 SP2
Xavier
Created on: 25 Jan 2021 12:33
Category: TreeView
Type: Bug Report
0
RadTreeView: issue when rename a root node and the SortOrder property is set

Steps to reproduce:

1. Set SortOrder to Ascending

2. Rename a root node

 

3 comments
ADMIN
Nadya
Posted on: 02 Feb 2021 09:33

Hello, Xavier,

I am sorry to hear that the suggested solution doesn't work correctly all the time. Due to the specificity of the issue, I am unable to suggest an appropriate solution. I would like to note that the issue is currently in development process. We will do our best to introduce a fix as soon as possible in the upcoming service pack or latest internal builds. Make sure that you subscribe to this item in order to get notified when its status has changed. 

Please excuse us for the inconvenience caused. Let me know if there is anything else I can help with. 

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Xavier
Posted on: 27 Jan 2021 15:06

Hello

i tried your solution, the first time it works fine.
If we do the manipulation several times, it does not work or we have an error

steps to reproduce:
rename ItemB to ZZZ: OK
rename ItemA to ItemZ: OK
rename ItemC: after clicking on F2, ItemB disappears
click on the RadTreeView : everything reappears
rename ItemZ: click on F2: SystemNullReferenceException
ADMIN
Nadya
Posted on: 25 Jan 2021 12:56

Hello, Xavier,

Currently, the possible solution I can suggest is to change the sort order to None when the node is editing and later restore it to desired order:

public TreeForm()
{
    InitializeComponent();
    radTreeView.Editing += this.RadTreeView_Editing;
    radTreeView.Edited += this.RadTreeView_Edited;

    this.radTreeView.AllowEdit = true;
    this.radTreeView.SortOrder = System.Windows.Forms.SortOrder.Ascending;

    RadTreeNode root = new RadTreeNode("Root");
    radTreeView.Nodes.Add(root);

    RadTreeNode itemA = new RadTreeNode("ItemA");
    root.Nodes.Add(itemA);
    itemA.Nodes.Add(new RadTreeNode("ASubItemA"));
    itemA.Nodes.Add(new RadTreeNode("ASubItemB"));
    itemA.Nodes.Add(new RadTreeNode("ASubItemC"));

    RadTreeNode itemB = new RadTreeNode("ItemB");
    root.Nodes.Add(itemB);
    itemB.Nodes.Add(new RadTreeNode("BSubItemA"));
    itemB.Nodes.Add(new RadTreeNode("BSubItemB"));

    RadTreeNode itemC = new RadTreeNode("ItemC");
    root.Nodes.Add(itemC);
    itemC.Nodes.Add(new RadTreeNode("CSubItemA"));
    itemC.Nodes.Add(new RadTreeNode("CSubItemB"));
    itemC.Nodes.Add(new RadTreeNode("CSubItemD"));
    itemC.Nodes.Add(new RadTreeNode("CSubItemE"));

    radTreeView.ExpandAll();
}
private void RadTreeView_Edited(object sender, TreeNodeEditedEventArgs e)
{
    radTreeView.SortOrder = System.Windows.Forms.SortOrder.Ascending;
}

private void RadTreeView_Editing(object sender, TreeNodeEditingEventArgs e)
{
    radTreeView.SortOrder = System.Windows.Forms.SortOrder.None;
}

I hope this helps. 

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.