Hi Princy,
I have implemented the On Demand Loading . There is a provision in my tree view control user can right click and select the option "Add a New Node" context menu item and can add a new items . But I want some thing like if the current node on which the mouse curse is not expanded( That means it is displaying the '+' symbol ) I have to inform the user to expand the node or I have to expand the node when user right clicks on the node . Can you please suggest me how can I able to know whether the current node is expanded or not ?
With Regards
Manoj
I have implemented the On Demand Loading . There is a provision in my tree view control user can right click and select the option "Add a New Node" context menu item and can add a new items . But I want some thing like if the current node on which the mouse curse is not expanded( That means it is displaying the '+' symbol ) I have to inform the user to expand the node or I have to expand the node when user right clicks on the node . Can you please suggest me how can I able to know whether the current node is expanded or not ?
With Regards
Manoj
5 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 04 Mar 2009, 07:01 AM
Hi Manoj,
Try the following code snippets for alerting user if node is not expanded and currently on right clicking the node. Attach the ClientContextMenuShowing() handler to OnClientContextMenuShowing event of RadTreeView.
JavaScript:
Thanks,
Princy.
Try the following code snippets for alerting user if node is not expanded and currently on right clicking the node. Attach the ClientContextMenuShowing() handler to OnClientContextMenuShowing event of RadTreeView.
JavaScript:
<script type="text/javascript"> |
function ClientContextMenuShowing(sender, eventArgs) |
{ |
var node = eventArgs.get_node(); |
if(node.get_expanded()==false) |
{ |
alert("Node is not expanded, First expand the node"); |
} |
} |
</script> |
Thanks,
Princy.
0
Manoj
Top achievements
Rank 1
answered on 04 Mar 2009, 09:52 AM
Hi Princy,
Thanks for your reply . I tried to use your suggested code but now the default window context menu is coming up . Can you suggest me how can I avoid this .
Thanks for your reply . I tried to use your suggested code but now the default window context menu is coming up . Can you suggest me how can I avoid this .
function
onClientContextMenuShowing(sender, args)
{
var treeNode = args.get_node();
if(treeNode.get_expanded()==false)
{
alert(
"Node is not expanded, First expand the node");
args.set_cancel(
true);
}
else
{
treeNode.set_selected(
true);
setMenuItemsState(args.get_menu().get_items(), treeNode);
}
}
Regards
Manoj
0
Princy
Top achievements
Rank 2
answered on 04 Mar 2009, 11:05 AM
Hi Manoj,
I tried to following code for cancelling the mouse click event. Try the JavaScript code.
JavaScript:
Thanks,
Princy.
I tried to following code for cancelling the mouse click event. Try the JavaScript code.
JavaScript:
<script type="text/javascript"> |
function OnClientContextMenuShowing(sender, eventArgs) |
{ |
var node = eventArgs.get_node(); |
if(node._hasChildren()) //checking whether the node having children |
{ |
if(node.get_expanded()==false) |
{ |
alert("Node is not expanded, First expand the node"); |
eventArgs.set_cancel(true); |
try |
{ |
var e = window.event; |
if(!e) e = window.Event; |
if(e) |
{ |
e.returnValue = false; |
e.cancelBubble = true; |
e.stopPropagation(); |
} |
} catch(c) {} |
return false; |
} |
} |
else |
{ |
node.set_selected(true); |
// setMenuItemsState(eventArgs.get_menu().get_items(), node); |
} |
} |
</script> |
Thanks,
Princy.
0
Manoj
Top achievements
Rank 1
answered on 04 Mar 2009, 12:40 PM
Hi Princy,
Its work fine . Thanks .
Regards
Manoj
Its work fine . Thanks .
Regards
Manoj
0
Manoj
Top achievements
Rank 1
answered on 05 Mar 2009, 06:44 AM
Hi Princy,
As I have implemented the Load On Demand , so I am expanding the leaf level node as client side . But when I am clicking the leaf level node I am getting the same message . It is working fine for the nodes which were not expanded ( having '+' symbol ) but not working for the leaf level node . Can you suggest me what should I do for this .
Regards
Manoj
As I have implemented the Load On Demand , so I am expanding the leaf level node as client side . But when I am clicking the leaf level node I am getting the same message . It is working fine for the nodes which were not expanded ( having '+' symbol ) but not working for the leaf level node . Can you suggest me what should I do for this .
Regards
Manoj