This is a migrated thread and some comments may be shown as answers.

RadTreeView Filter problem

4 Answers 233 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 31 May 2013, 10:00 AM

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?

4 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 05 Jun 2013, 09:15 AM
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?
0
Dev3
Top achievements
Rank 1
answered on 25 Apr 2014, 04:31 AM
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

0
Stefan
Telerik team
answered on 25 Apr 2014, 07:08 AM
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.
 
0
Accepted
Dev3
Top achievements
Rank 1
answered on 02 May 2014, 07:56 AM
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;
}
Tags
Treeview
Asked by
Thomas
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Dev3
Top achievements
Rank 1
Share this question
or