Self-referencing C1TreeView insert item into binding list

Posted by: kbj on 12 February 2023, 6:53 am EST

  • Posted 12 February 2023, 6:53 am EST

    When adding an item into a KeyField/ParentKeyField bound treeview, the new child item always shows up at the end of its group. In the following example, is there a way to have the child (2.2) show up between its two siblings (2.1 & 2.3)?

    Imports System.ComponentModel
    Imports C1.Win.TreeView
    
    Public Class Form1
        Private bl As New BindingList(Of classData)
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
            bl.Add(New classData("0", "1"))
            bl.Add(New classData("0", "2"))
            bl.Add(New classData("2", "2.1"))
            bl.Add(New classData("2", "2.3"))
            bl.Add(New classData("0", "3"))
            Dim column = New C1TreeColumn()
            column.DisplayFieldName = "title"
            column.HeaderText = "title"
            C1TreeView1.Columns.Clear()
            C1TreeView1.Columns.Add(column)
            C1TreeView1.BindingInfo.KeyField = "title"
            C1TreeView1.BindingInfo.ParentKeyField = "parent"
            C1TreeView1.BindingInfo.DataSource = bl
        End Sub
        Private Sub Form1_MouseClick(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
            bl.Insert(3, New classData("2", "2.2"))
        End Sub
    End Class
    Public Class classData
        Public Property parent As String
        Public Property title As String
        Public Sub New(parent As String, title As String)
            Me.parent = parent
            Me.title = title
        End Sub
    End Class
  • Posted 13 February 2023, 4:04 pm EST

    Hi,

    We have replicated this issue at our end. We are discussing this with the development team and will get back to you once we have any update from them.[Internal Tracking Id - C1WIN-29109]

    Regards,

    Nitin

  • Posted 14 February 2023, 6:06 am EST

    Hi Nitin,

    while you are at it, please note that if you remove a bound object from a bindinglist that is the data for a child C1TreeNode, the parent node will collapse, which is not ideal. If the child node is removed directly, as in:

    C1TreeView1.Nodes(1).Nodes.RemoveAt(0)

    the parent remains expanded.

    -Kingman

  • Posted 14 February 2023, 6:24 pm EST - Updated 14 February 2023, 6:29 pm EST

    Hi,

    We are unable to replicate this issue at our end. This work correct i.e., while deleting a child node, the parent node is not collapsing which is a correct behavior. (see gif)

    We have checked with latest 4.8.20223.588 version.

    Please refer the attached sample for the same:TreeViewDemo.zip

    Best Regards,

    Nitin

  • Posted 15 February 2023, 5:25 am EST

    Nitin,

    Please reread my post.

    As I said above:

    removing an item from a bindinglist that is the data for a child C1TreeNode the parent node will collapse, which is not ideal.

  • Posted 15 February 2023, 8:26 pm EST

    Hi,

    Apologize for the misunderstanding.

    We have replicated the issue while deleting the child node through BindingList. This seems like a bug. So, we have escalated it to the development team. Will get back to you once we have any update from them.[Internal Tracking Id - C1WIN-29121]

    Best Regards,

    Nitin

  • Posted 12 December 2023, 10:21 am EST

    Is this still not fixed?

  • Posted 12 December 2023, 5:11 pm EST

    Hi,

    Apologize for the delay.

    We have asked for an update on this issue from the development team.

    Will get back to you once we have any update from them as soon as possible.

    Regards,

    Nitin

  • Posted 29 January 2024, 4:27 pm EST

    Hi,

    Apologize for the inconvenience.

    As per the development team, this is a limitation of C1TreeView, you can call to the Expand method of a specific node or the ExpandAll method of C1TreeView.

    The current version of C1TreeView reloads the tree if the user removed an element from a self-referencing data source.

    Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels