RadTreeView Filter problem

5 posts, 2 answers
  1. Thomas
    Thomas avatar
    22 posts
    Member since:
    Oct 2012

    Posted 31 May 2013 Link to this post

    Hello. I have two problems with filtering in RadTreeView control.
    1. I add nodes to tree when filtering is enabled.

    Code: 

    radTreeView1.Filter = "new";
    radTreeView1.Nodes.Add( "new Node" );
    for ( int i = 0; i < 1000; i++ )
    {
       radTreeView1.Nodes.Add( new RadTreeNode( "test" ) );
    }

    You can see that after this actions scroll does not work correctly (see screenshot 1).

    2. Some node is added to tree when filter was enabled.

    radTreeView1.Filter = "new";
    var node = new RadTreeNode( "test" );
    radTreeView1.Nodes.Add( node );
    After some actions I must to check if node was added. When node was not added I add it again.
    if ( radTreeView1.Nodes.Contains( node ) == false )
    {
     radTreeView1.Nodes.Add( new RadTreeNode( "test" ) );
    }
     
    I  don't know how to check is node is present in tree. When node is filtered it is absent in Nodes.
    How can I check that node is present in tree?

  2. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 05 Jun 2013 Link to this post

    Hello Thomas,

    Thank you for writing.

    Directly to your questions:

    1. I can confirm this is an issue and I logged it in our 
    Public Issue Tracking System. Here you can track the issue status: http://www.telerik.com/support/pits.aspx#/public/winforms/15126. To work around it, just call the Update method of the TreeViewElement:
    radTreeView1.Filter = "new";
    radTreeView1.Nodes.Add("new Node");
    for (int i = 0; i < 1000; i++)
    {
        radTreeView1.Nodes.Add(new RadTreeNode("test"));
    }
    radTreeView1.TreeViewElement.Update(RadTreeViewElement.UpdateActions.Reset);

    2. When you filter the tree, the nodes will no longer be in the Nodes collection, thus you cannot check whether they exist in there or not. You can set the Filter to null, check if node exists and then restore the filter. I will add another PITS item as feature request for such a functionality. You can vote for it here: http://www.telerik.com/support/pits.aspx#/public/winforms/15127.

    I have updated your 
    Telerik Points for these reports. 

    Should you have any other questions or suggestions, do not hesitate to contact us.
     

    Regards,
    Stefan
    Telerik
    RadChart for WinForms is obsolete. Now what?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dev3
    Dev3 avatar
    2 posts
    Member since:
    Mar 2014

    Posted 24 Apr 2014 in reply to Stefan Link to this post

    I found similar Problem, and have been fixed it, it seems rad tree view bugs (CMIIW) ?
    Update must call from event radTreeUser_NodeExpandedChanged.

    radTreeUser.NodeExpandedChanged += radTreeUser_NodeExpandedChanged;
    void radTreeUser_NodeExpandedChanged(object sender, RadTreeViewEventArgs e)
    {
    radTreeUser.TreeViewElement.Update(RadTreeViewElement.UpdateActions.Reset);
    }


    Regards,
    Ardi

  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 25 Apr 2014 Link to this post

    Hi Ardi,

    Thank you for writing.

    You approach is suitable to resolve the scroll bar issue in your case. Feel free to use it.

    For convenience, I will include the new links to the issues logged here:
    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Answer
    Dev3
    Dev3 avatar
    2 posts
    Member since:
    Mar 2014

    Posted 02 May 2014 in reply to Stefan Link to this post

    when call radTree.TreeViewElement.Update(RadTreeViewElement.UpdateActions.Reset), vertical scroll bar position is reset to 0. Need to set the vscroll bar position to position before reset.
    need to add this:

    void radTreeUser_NodeExpandedChanged(object sender, RadTreeViewEventArgs e)
    {
         int intLastVPos = radTreeUser.VScrollBar.Value;
         radTreeUser.TreeViewElement.Update(RadTreeViewElement.UpdateActions.Reset);
         radTreeUser.VScrollBar.Value = intLastVPos;
    }
Back to Top
UI for WinForms is Visual Studio 2017 Ready