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

New Folder & Rename Dialog - Highlight Text

3 Answers 75 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Jacob Button
Top achievements
Rank 1
Jacob Button asked on 08 Sep 2016, 02:33 PM

Apologies if this has already been addressed.

Is there a way to intercept and access the dialog box that opens when Rename or New Folder is clicked?  I'd like to select the text in the textbox (minus file extension if applicable) when the dialog box opens.

I've gotten feedback from my users who are frustrated with the current text box behavior of inserting text before "New Folder" or "[Existing File/Folder Name]" rather than replacing it when they begin typing after hitting Rename/New Folder as they expect because that's the behavior they're used to with Windows Explorer.

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Sep 2016, 10:45 AM
Hi Jacob,

Here is a code example that you can use to customize the File Explorer and achieve your goal:

<telerik:RadFileExplorer RenderMode="Lightweight" runat="server" ID="FileExplorer1" OnClientLoad="OnClientLoad">
    <Configuration ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images"></Configuration>
</telerik:RadFileExplorer>
<script type="text/javascript">
    function OnClientLoad(fileExplorer) {
        fileExplorer.get_windowManager().add_show(function (promptDialog) {
 
            if (promptDialog.get_title() == "Rename" || promptDialog.get_title() == "Enter the new folder name") {
 
                $telerik.$(".rwPromptInput").on('focus', function (e) {
                    $(this)
                        .one('mouseup', function () {
                            $(this).select();
                            return false;
                        })
                        .select();
                });
            }
        });
    }
</script>

Feel free to modify the code to better cover your specific customer requirements.

Regards,
Rumen
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Jacob Button
Top achievements
Rank 1
answered on 13 Sep 2016, 08:32 PM

Rumen, 

Thanks for the response. I'm still having a few issues.

 

$(".rwPromptInput").on('focus')

didn't seem to do anything. I had to change it too 

$(".rwDialogInput").on('focus')

and that seemed to do that trick, but we're still not quite there.

This only fires on the first radwindow to open on the page (the first rename, or the first new folder), id does not fire on any subsequent rename or new folder there after until the page is reloaded. Can we do anything about that?

 

0
Rumen
Telerik team
answered on 16 Sep 2016, 01:47 PM
Hello,

I didn't get such issue on my end as you can see in this video: http://screencast.com/t/GfSqCNmkW3UQ.

For your convenience I have attached my project.

Regards,
Rumen
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
FileExplorer
Asked by
Jacob Button
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Jacob Button
Top achievements
Rank 1
Share this question
or