Hi,
I would like to ask if the telerik treeview has this functionality that when the treeview has reached the 4th tier, no nodes can be dropped in that node.
For example:
Parent 1
>child 1
>granchild 1
>grandchild 2
Parent 2
is there a way that i can prevent this if I try to drag and drop the parent 2 in the grandchild 2?
Thanks
Jhobs
I would like to ask if the telerik treeview has this functionality that when the treeview has reached the 4th tier, no nodes can be dropped in that node.
For example:
Parent 1
>child 1
>granchild 1
>grandchild 2
Parent 2
is there a way that i can prevent this if I try to drag and drop the parent 2 in the grandchild 2?
Thanks
Jhobs
15 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 16 Mar 2010, 11:20 AM
Hello Jhobs,
You can check for the destination node's level in the OnClientNodeDropping event and cancel the event if level is four. Here is the example.
JavaScript:
<script type="text/javascript"> |
function OnClientNodeDropping(sender, args) { |
if (args.get_destNode().get_level() > 3) { |
alert('Cannot drop node here'); |
args.set_cancel(true); // Cancel the event |
} |
} |
</script> |
Regards,
Shinu.
0
Jo Bert
Top achievements
Rank 1
answered on 16 Mar 2010, 11:56 AM
Thanks Shinu... :-)
I have a follow up question, what if I want to prevent users from dragging node in a specific node? can I specify the title of the node that i want to cancel the event?
Thank you very much :)
I have a follow up question, what if I want to prevent users from dragging node in a specific node? can I specify the title of the node that i want to cancel the event?
Thank you very much :)
0
Hi Jo Bert,
You can also set AllowDrop property of these nodes to false when you create them.
All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can also set AllowDrop property of these nodes to false when you create them.
All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo Bert
Top achievements
Rank 1
answered on 18 Mar 2010, 12:41 AM
Hi Yana,
the AllowDrag is only available if you create the <nodes><telerik:radtreenode> in the treeview right? but what if i have an xml as my xmldatasource? how can i specify one node in that xml that will not have drag and drop functionality?
Thanks
the AllowDrag is only available if you create the <nodes><telerik:radtreenode> in the treeview right? but what if i have an xml as my xmldatasource? how can i specify one node in that xml that will not have drag and drop functionality?
Thanks
0
Hello Jo Bert,
You can subscribe to OnNodeCreated event and set this property in its handler.
Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can subscribe to OnNodeCreated event and set this property in its handler.
Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo Bert
Top achievements
Rank 1
answered on 19 Mar 2010, 02:52 PM
Thanks Yana... But what if I'm just creating the node on the fly. what i mean is i am only creating the node like this:
dim node as string = <parent id="1" url="" title="">
and then i added this to the xml string which the radtreeview is loading.
dim node as string = <parent id="1" url="" title="">
and then i added this to the xml string which the radtreeview is loading.
0
Jo Bert
Top achievements
Rank 1
answered on 23 Mar 2010, 07:30 AM
I also have problem with counting the depth of the parent node. what i want to happen is that no items should be added when the treeview reaches the 4th tier.
Here is another scenario:
Parent1
Child 1
Child2
Parent2
Child4
What if i drag parent2 under child 2? The expected behavior here is that it will still allow the the Parent2 to be added because it will be the 4th tier of the treeview. But this will also display the child of the Parent2 making the levels of the treeview to 5 tiers.
Parent1
Child 1
Child2
Parent2
Child4
Is there a way to check both the sourcenode and destnode on node drop? that if the number of tiers of the two exceeded 4 tiers, this will prompt a message box?
Thanks
Here is another scenario:
Parent1
Child 1
Child2
Parent2
Child4
What if i drag parent2 under child 2? The expected behavior here is that it will still allow the the Parent2 to be added because it will be the 4th tier of the treeview. But this will also display the child of the Parent2 making the levels of the treeview to 5 tiers.
Parent1
Child 1
Child2
Parent2
Child4
Is there a way to check both the sourcenode and destnode on node drop? that if the number of tiers of the two exceeded 4 tiers, this will prompt a message box?
Thanks
0
Hello Jo Bert,
You can use the nodes get_level() client-side method in OnClientNodeDropping event and cancel the dropping. Full list of the client-side methods of a node can be found here.
Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can use the nodes get_level() client-side method in OnClientNodeDropping event and cancel the dropping. Full list of the client-side methods of a node can be found here.
Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo Bert
Top achievements
Rank 1
answered on 25 Mar 2010, 08:07 AM
Thanks Yana. I'll just play around with those client script. Though I still have another question. in the Rad Treeview, we can specify the xml file it will use, we just have to specify the XPath right? my question is, after the treeview loads the xml file and displays the right nodes, is there a way to get the XML code of a treeview? I've read that Radtreeview.GetXML retrieves the xml file of the treeview but it does not return the xml format same as the one we specify in the new xml file.
Thanks
Thanks
0
Hi Jo Bert,
GetXml() is the only method that RadTreeView provides to return its structure in xml format. What exactly is your xml format?
Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
GetXml() is the only method that RadTreeView provides to return its structure in xml format. What exactly is your xml format?
Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo Bert
Top achievements
Rank 1
answered on 30 Mar 2010, 02:21 AM
Hi Yana,
The xml i load in the tree view is something like this, <List><Parent></Parent></List>. But i use the GetXML method of the treeview it returns <Tree><Node></Node></Tree>. Is there a way that the radtreeview can return the xml I load? because i need to get the current of the treeview upon drag and drop.
Does the new telerik version behaves the same?
Thanks
The xml i load in the tree view is something like this, <List><Parent></Parent></List>. But i use the GetXML method of the treeview it returns <Tree><Node></Node></Tree>. Is there a way that the radtreeview can return the xml I load? because i need to get the current of the treeview upon drag and drop.
Does the new telerik version behaves the same?
Thanks
0
Hi Jo Bert,
I'm afraid that GetXml returns the treeview in exactly this format.
Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I'm afraid that GetXml returns the treeview in exactly this format.
Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo Bert
Top achievements
Rank 1
answered on 05 Apr 2010, 09:32 AM
Thanks Yana, another thing, does the Getxml method of the treeview retrieves the exact pattern of the treeview.
for example, I enabled the drag and drop property of the treeview then i also have a button which onclick will get the xml of the treeview control. If i reordered my treeview then call the GetXML Method, will this return the xml same as what I reordered the control?
Thanks
for example, I enabled the drag and drop property of the treeview then i also have a button which onclick will get the xml of the treeview control. If i reordered my treeview then call the GetXML Method, will this return the xml same as what I reordered the control?
Thanks
0
Hi Jo Bert,
If you do it after reordering the Tree Nodes, the GetXml will return the current, i.e. reordered state of the TreeView.
All the best,
Dimitar Milushev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
If you do it after reordering the Tree Nodes, the GetXml will return the current, i.e. reordered state of the TreeView.
All the best,
Dimitar Milushev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jo Bert
Top achievements
Rank 1
answered on 07 Apr 2010, 12:15 PM
Thanks Dimitar...
maybe you also have an answer with my other thread http://www.telerik.com/community/forums/aspnet-ajax/treeview/get-nodes-count-on-onnodedropping-function.aspx.
thanks a lot.
maybe you also have an answer with my other thread http://www.telerik.com/community/forums/aspnet-ajax/treeview/get-nodes-count-on-onnodedropping-function.aspx.
thanks a lot.