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

Editor dialogs ReloadOnShow property

1 Answer 35 Views
Editor
This is a migrated thread and some comments may be shown as answers.
ido nahmias
Top achievements
Rank 1
ido nahmias asked on 22 Apr 2014, 01:12 PM
Hello,

Is there any way to set the default behavior for reloading the editor dialogs?
I know that you can set the "ReloadOnShow" property for the "DialogDefinition" class but i cant find a way to set it for the editor dialogs.

Thank you

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 24 Apr 2014, 12:06 PM

Hello Ido,

I can suggest achieving that via client-side approach and set the ReloadOnShow property with the dialog's API.

I can propose two available implementations:

  • Setting the ReloadOnShow to true to all dialogs that can be set with this property:
    <telerik:RadEditor runat="server" ID="RadEditor1" OnClientCommandExecuted="OnClientCommandExecuted">
    </telerik:RadEditor>
     
    <script type="text/javascript">
        function OnClientCommandExecuted(editor, args) {
            var command = args.get_commandName();
            var dialogs = editor.get_dialogOpener()._dialogContainers;
            var dialog = dialogs[command];
     
            if (dialog && dialog.get_reloadOnShow && !dialog.get_reloadOnShow())
                dialog.set_reloadOnShow(true);
        }
    </script>
  • Setting it only to the predefined dialogs:
    <telerik:RadEditor runat="server" ID="RadEditor1" OnClientCommandExecuted="OnClientCommandExecuted">
    </telerik:RadEditor>
     
    <script type="text/javascript">
        function OnClientCommandExecuted(editor, args) {
            var command = args.get_commandName();
            var dialogs = editor.get_dialogOpener()._dialogContainers;
            var dialog = dialogs[command];
             
            if (dialog) {
                var dialogName = command;
                switch (dialogName) {
                    case "ImageManager":
                        if (dialog && dialog.get_reloadOnShow && !dialog.get_reloadOnShow())
                            dialog.set_reloadOnShow(true);
     
                        break;
                    case "DocumentManager":
                        if (dialog && dialog.get_reloadOnShow && !dialog.get_reloadOnShow())
                            dialog.set_reloadOnShow(true);
     
                        break;
     
                        //You can set further the desired dialogs as the above logic
     
                    default:
                        break;
                }
            }
        }
    </script>

Regards,

Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
ido nahmias
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or