RadEditor - Image Manager - Custom File Dialogs - Javascript Reload

5 posts, 0 answers
  1. Roelf
    Roelf avatar
    10 posts
    Member since:
    Mar 2015

    Posted 30 Oct 2015 Link to this post

    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

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 30 Oct 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Roelf
    Roelf avatar
    10 posts
    Member since:
    Mar 2015

    Posted 02 Nov 2015 in reply to Ianko Link to this post

    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?

  5. Roelf
    Roelf avatar
    10 posts
    Member since:
    Mar 2015

    Posted 02 Nov 2015 Link to this post

    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;
            }

  6. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 03 Nov 2015 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017