Keyboard Shortcut for Rename Folder

7 posts, 0 answers
  1. Naveen
    Naveen avatar
    8 posts
    Member since:
    Apr 2011

    Posted 06 Apr 2011 Link to this post

    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
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 07 Apr 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Naveen
    Naveen avatar
    8 posts
    Member since:
    Apr 2011

    Posted 07 Apr 2011 Link to this post

    Hi Dobromir,

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


    Thanks,
    Naveen.
  5. Naveen
    Naveen avatar
    8 posts
    Member since:
    Apr 2011

    Posted 11 Apr 2011 Link to this post

    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.
  6. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 11 Apr 2011 Link to this post

    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.

  7. Naveen
    Naveen avatar
    8 posts
    Member since:
    Apr 2011

    Posted 13 Apr 2011 Link to this post

    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.

  8. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 18 Apr 2011 Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017