resizing a richwidgets\popup at runtime

resizing a richwidgets\popup at runtime

  
We have a popup in which the size of the contents (width and height) changes depending on what the user clicks on in the popup (mainly tabs right now).  I have set the width to be set, but the height does change.  Is there a way to resize height and width of a popup dynamically?
Hi Jason,

You should set the "AutoResize" parameter of the Popup_Editor widget to "True". It should then resize when you Ajax refresh the content.
Jason,
Underneath that, you also have an optional "RecenterOnResize".
Kilian and Tiago,

The issue we are having is that the auto resize works going bigger in either width or height, however it does not work going back the other direction.  So if my popup starts at say 4 col width and a tab grows the page to 7 col, when I go back to the 4 col tab you have white space to the right of the content and it does not "auto shrink".  The same thing in the height if a tab is long height wise and you go to a shorter height content tab, the popup does not resize.
Ok, maybe this is what I am missing: for both of those fields it says "after an ajax refresh" so if my tabs change do I need to do an ajax refresh of the whole popup?
Hi Jason,

The pop-up not resizing back when the content gets smaller is a known issue, that OutSystems doesn't want to address. See here for more information.
Unfortunately, popups are a strange beast in OutSystems :)
nice!  I got it looking decent for what I wanted but still, if you have resize, that does not mean resize in one direction :P

Old post, but in case other people are looking, you can do the auto-shrink with something like this code snippet

function PopupEditor_ForceResize() {
    try {
        var popupDiv = window.top.$('.os-internal-ui-dialog-content');
        var popupIframe = window.top.$('.os-internal-ui-dialog-content iframe:first');
        var popupIframeOldHeight = popupIframe.height();
        
        // reduce iframe height to its contents
        var mainPopupHeight = document.getElementsByClassName('MainPopup')[0].clientHeight;
        popupDiv.height(mainPopupHeight);
        
        // pop-up editor already auto-grows, so we just need to address auto-shrink
        if (popupIframe.height() >= popupIframeOldHeight) {
            return false;
        }
        
        var result = window.top.RichWidgets_Popup_Editor_resize(popupDiv, -1, -1, false, {target: popupDiv});
        
        if (!result) {
            // something wrong happened in resize - reset iframe height
            popupIframe.height(popupIframeOldHeight);
        }
    } catch (err) {}
}


Usage:

Place that JS on your webscreen, then in a server action where you think your popup content can shrink, do a HTTPRequestHandler/RunJavaScript and call the action 

"PopupEditor_ForceResize();"


That code is from https://success.outsystems.com/Documentation/Development_FAQs/How_to_resize_a_pop-up_window


Happy OSing!