Completed
Last Updated: 08 Sep 2015 10:34 by Luigi Gaeta
ADMIN
Ianko
Created on: 07 Jul 2015 05:50
Category: Editor
Type: Bug Report
0
Using DialogOpener with UseClassicDialogs set to true leads to JS error on opening a dialog
When there is a need to open dialogs in browser's window instead of RadWindow, the UseClassicDialogs property is being used. With the release of Q2 2015 the functionality stopped working and throws JS error when a dialog is opened. 

To workaround this behavior you can apply the JS patch as shown below:  

    <telerik:RadEditor runat="server" ID="RadEditor1"></telerik:RadEditor>
    
    <script type="text/javascript">
        Telerik.Web.UI.RadDialogOpener.prototype._applyParameters = function (dialogName, container) {
            //If no parameters provided, return
            var parameters = this._getDialogParameters(dialogName);
            if (!parameters) return;
    
            var parametersUrlPart = "&dp=" + encodeURIComponent(parameters);
            var baseUrl = this._getBaseDialogUrl(dialogName);
            var totalUrlLength = baseUrl.length + parametersUrlPart.length;
    
            var parametersPassedFromClient = this._dialogParametersProviderTypeName == "";
            var parametersPassedThroughUrl = parametersPassedFromClient && totalUrlLength <= this.get_dialogUrlLengthLimit();
    
            if (parametersPassedThroughUrl) {
                //NEW: If the dialog features the same URL, do not reload it
                var curUrl = container.get_navigateUrl();
                var url = baseUrl + parametersUrlPart;
    
                if (curUrl != url) {
                    if (this.get_useClassicDialogs() || container.isCreated()) {
                        container.setUrl(url);
                    }
                    else {
                        container.set_navigateUrl(url);
                    }
                }
                else //Reinitialize
                {
                    var contentFrame = container.get_contentFrame();
                    if (contentFrame && contentFrame.contentWindow && contentFrame.contentWindow.$find) {
                        //TODO: Probably implement a global function initializeDialog that will be called automatically - easy for custom dialogs
                        var initDialog = contentFrame.contentWindow.initDialog;
                        if (initDialog) {
                            contentFrame.contentWindow.setTimeout(function () { initDialog(); }, 1);
                        }
                    }
                }
            }
            else {
                container.setUrl(baseUrl);
                container.DialogParameters = parameters;
            }
        };
    
    </script>
1 comment
Luigi Gaeta
Posted on: 08 Sep 2015 10:34
I'm experimenting another issue with IE11 and UseClassicDialogs = "true", the dialog doesn't close itself with "Insert" or "Cancel" buttons, but only with "X" in the upper right corner of the pop-up window.
Do you have some workaround for this problem?
Many thanks
Luigi