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

Keyboard Shortcut for Rename Folder

6 Answers 108 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Naveen
Top achievements
Rank 1
Naveen asked on 06 Apr 2011, 03:44 PM
Hi ,

I am using latest version of file explorer. It is cool.
In it I saw that we cannot assign a Keyboard shortcut for Rename, where as we can assign the keyboard shortcuts for Delete,Upload,Create New Folder etc.,
I want to use "F2" as a keyboard shortcut for Renaming a Folder instead of right clicking on the Folder and then click on Rename.
Can you help me how to achieve it?

Thanks and regards,
Naveen

6 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 07 Apr 2011, 12:03 PM
Hi Naveen,

At present, it is not possible to assign shortcut to the Rename command out-of-the-box and is not a trivial task to accomplish. The problem is that rename is a bit more complicated command due to the fact that is need to be handled entirely differently if it is fired for a Tree node or for a Grid Row. We will consider implementing the support of this short cut but I cannot provide a firm estimate.

For the time being, you can use the following approach to assign a shortcut to the Rename command:
<telerik:RadFileExplorer ID="RadFileExplorer1" runat="server">
    <Configuration ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
</telerik:RadFileExplorer>
 
<script type="text/javascript">
    Sys.Application.add_load(assignShortCutHandler);
 
    function assignShortCutHandler()
    {
        Sys.Application.remove_load(assignShortCutHandler);
        $addHandler(document.body, "keyup", keyUpHandler);
    }
 
    function keyUpHandler(e)
    {
        if (e.keyCode == 113)//handle F2 keyup
        {
            var explorer = $find("<%=RadFileExplorer1.ClientID %>"); //get reference to the fileexplorer
            if (!explorer) return;
 
            var grid = explorer.get_grid();//get reference to the grid component
            var treeView = explorer.get_tree(); //get reference to the treeview component
 
            var gridSelectedItems = grid.get_selectedItems();
 
            if (grid.get_selectedItems().length > 1) return;//in case multiple items are selected cancel the execution of the rename
 
            if (grid.get_selectedItems().length == 1)
            {
                explorer._gridContextMenuSelectedItem = grid.get_selectedItems()[0];
                explorer.get_gridContextMenu().findItemByValue("Rename").click();
 
                return;
            }
 
            if (grid.get_selectedItems().length < 1)
            {
                treeView.get_selectedNode().startEdit();
                return;
            }
        }
    }
</script>


Best wishes,
Dobromir
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
Naveen
Top achievements
Rank 1
answered on 07 Apr 2011, 02:13 PM
Hi Dobromir,

Thanks for fast reply.
It is working fine for me.
It is cool.


Thanks,
Naveen.
0
Naveen
Top achievements
Rank 1
answered on 11 Apr 2011, 02:00 PM
Hi Dobromir,

I have checked the functionality for the code given. It is working fine  in IE but it is not working properly in Firefox 3.6.16.
 The problem occurs when I selected a node and pressed "F2", it is not allowing me to rename.
 When I am selecting an item in grid of file explorer and pressing "F2" button it is showing me a Rename Confirmation Box as expected,
But on selecting a node and pressing F2 doesn't working for me on Firefox 3.6.16.

Could you please help?

Thanks and Regards,
Naveen.
0
Dobromir
Telerik team
answered on 11 Apr 2011, 02:29 PM
Hi Naveen,

I tried the sample once again under FireFox 3.6.16 and it was working as expected. Could you please open a formal support ticket and provide a sample fully runnable project reproducing the problem so we can investigate it further?

For your convenience I have prepared a video demonstrating my test. Could you see if I am doing something wrong?
http://screencast.com/t/3imPAMTo4l

Greetings,
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.

0
Naveen
Top achievements
Rank 1
answered on 13 Apr 2011, 08:25 AM

Hi Dobromir,

The below code is working fine in FireFox 3.6.16 when I have called jQuery event handler instead of javascript event handler.
I have changed the code


$addHandler(document.body, "keyup", keyUpHandler);   to   $(document).keyup(function(e) { keyUpHandler(e);  });

But the problem comes when I have two File Explorers on my page, the Rename selection goes weird.
Suppose If I select a Item of File Explorer 2(say), next I will select only a node of File Explorer 1(say), then pressing "F2" shows me a Rename Confirmation Box of File Explorer 2's Item selected.
But here I should get File Explorer 1's node as it was my last selection.

Can you please help?

Thanks & Regards,
Naveen.

0
Dobromir
Telerik team
answered on 18 Apr 2011, 11:20 AM
Hi Naveen,

The scenario with multiple RadFileExplorers on the page is a bit different - the keyUpHandler function uses a reference of a specific explorer
  var explorer = $find("<%=RadFileExplorer1.ClientID %>"); //get reference to the fileexplorer

To be able to provide this functionality for multiple explorer I would suggest you to use a hidden field and store the ID of the last selected RadFileExplorer. For your convenience I have attached a sample page implementing this approach.

Kind regards,
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
Naveen
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Naveen
Top achievements
Rank 1
Share this question
or