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

RadEditor - Image Manager - Custom File Dialogs - Javascript Reload

4 Answers 45 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Roelf
Top achievements
Rank 1
Roelf asked on 30 Oct 2015, 08:41 AM

Hi

 We are using RadEditors with Image Managers that use a custom file dialog via FileBrowserContentProvider. The reason is that our images need to go through an approval process before they can be added to the content. Everything is working except when a new image is added.

When you click on the image manager icon the first time, it fires the ResolveDirectory() override in our code and all is good and displayed correctly. Now the users adds a new image that goes through our approval process (on another control on the page, not part of the radeditor). Now the user clicks on the Image Manager again, but the ResolveDirectory() override does not fire again (I put a break in my code to test). And thus the user does not see the new image and has to click the refresh button. Although this is minor, it is generating a lot of support calls from users.

 Is there a javascript method we can use to force the Image Manager and similarly the Document Manager to refresh?

 Thanks

4 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 30 Oct 2015, 09:39 AM
Hi Roelf,

The dialog of the File Manager is an ordinary RadWindow instance (http://docs.telerik.com/devtools/aspnet-ajax/controls/window/client-side-programming/radwindow-object), therefore, you can use the reload() method to refresh the dialog.

How exactly to implement that in your code should be handled manually as it depends on the current scenario. 

Regards,
Ianko
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Roelf
Top achievements
Rank 1
answered on 02 Nov 2015, 09:55 AM

Hi

 Thank you. However, I am unsure how to get the id or Radwindow object in javascript to do a reload. Would you be able to assist?

0
Roelf
Top achievements
Rank 1
answered on 02 Nov 2015, 11:10 AM

I have been looking at this, but haven't been able to get it working:

 

function OnClientCommandExecuted(editor, args) {
            if (args.get_commandName() == "ImageManager" || args.get_commandName() == "DocumentManager") {
                var radWindow = GetRadWindow();
                radWindow.reload();
            }
        }
 
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
            else if (window.frameElement && window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;//IE (and Moz az well)
 
            return oWindow;
        }

0
Ianko
Telerik team
answered on 03 Nov 2015, 07:04 AM
Hello,

This would work if the GetRadWindow code is implemented inside the user control that is opened by the RadWindow. But this code is in the page where RadEditor is. 

The DialogOpener instance should be used:
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientCommandExecuted="OnClientCommandExecuted">
</telerik:RadEditor>
 
<script>
    function OnClientCommandExecuted(editor, args) {
        var dialog;
 
        if (args.get_commandName() == "ImageManager" || args.get_commandName() == "DocumentManager") {
            dialog = editor.get_dialogOpener()._dialogContainers[args.get_commandName()];
            dialog.add_show(function (sender, args) {
                sender.reload();
            })
        }
    }
</script>

Regards,
Ianko
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Editor
Asked by
Roelf
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Roelf
Top achievements
Rank 1
Share this question
or