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

Get the value of the node clicked in treeview

1 Answer 108 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 03 Feb 2011, 01:17 PM
I have been using the RadFileExplorer and have been getting on great with it, its a fantastic control. One thing I'm trying to do is add a lot of custom menu items. I have followed code examples on here to achieve this and it all all appears to work well apart from the menu in the tree view. if i right click an item the code uses the node currently selected, not the node i clicked, therefore I have to click the node I want before right clicking it again for the context menu to achieve the results I want, I've looked through the Documentation available online for both the file explorer and tree view but cannot see the client side code to achieve what I want, below is the client side code I currently use, any solution would be greatly appreciated!

function treeContextMenuClicked(toolbar, args) {
        var buttonValue = args.get_menuItem().get_value();
        var fileExplorer = $find("<% = rfeFilesAndFolders.ClientID %>");
        var treeView = fileExplorer.get_tree();
        var fID = treeView.get_selectedNode().get_attributes().getAttribute("FolderId");
        var fType = treeView.get_selectedNode().get_attributes().getAttribute("FolderType");
        var msg = fID + " " + fType
        var isSilverlight = 1;
         
        if (buttonValue == "share" && fType == 2) {
            var sURL = '<%=session("webbase") %>Share/' + fID + '/Add'
            var owindow = radopen(sURL, null);
            owindow.SetTitle('Share Object');
            owindow.SetSize(530, 360);
            owindow.Center();
            return false;
        }

1 Answer, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 04 Feb 2011, 03:19 PM
Hi James,

In order to get reference to the node that has called the context menu, you need to use the arguments object, e.g.:
function OnClientContextMenuItemClicked(sender, args)
{
    var node = args.get_node();
    //............
}


All the best,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
FileExplorer
Asked by
James
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or