Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Set popup width in nested popup window

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2121 Views
  • PieterV
    Avatar
    Community Member
    4 Posts

    Set popup width in nested popup window Link to this post

    I am having a problem with setting the width of a nested popup window.

    The first window i was able to set its width via $DataObjectManager->set_popup_width(800); but this did not work when setting the width of the window that pops up inside this window.

    The code: http://pastebin.com/PR4rXDsF

    Does anyone know a fix for this? i also tried globally setting all window widths via DataObjectManager::set_popup_width(800); in my config file but this did not change the nested windows width either.

    Any help would be appreciated.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Set popup width in nested popup window Link to this post

    Don't you want $manager->setPopupWidth()?

  • PieterV
    Avatar
    Community Member
    4 Posts

    Re: Set popup width in nested popup window Link to this post

    If i change my code from "set_popup_width(800)" to "setPopupWidth(800)" the nested window still does not use the set width. Both functions give me the same result: the first window resizes correctly but the child window does not.

    Any ideas of ways to test what the problem could be?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Set popup width in nested popup window Link to this post

    Ohh.. No, it doesn't work for nested DOM.

  • PieterV
    Avatar
    Community Member
    4 Posts

    Re: Set popup width in nested popup window Link to this post

    Ooh, do you know if there is a work around for this? or a way to set the default popup width for all windows that the nested window would get set to?

    The problem is the SimpleHTMLEditorField is wider than the window, so it sets ugly scroll bars and makes its hard to use. I only need it another 100px really.

    Thanks for your help!

  • PieterV
    Avatar
    Community Member
    4 Posts

    Re: Set popup width in nested popup window Link to this post

    So i have fixed the problem, but i needed to hack the data object core js files, "dataobject_manager.js" and "dataobjectmanager_popup.js".

    Below is the updated code for "dataobject_manager.js"
    http://pastebin.com/eDCvtatx
    I made changes on lines 31, 46 and 61

    The other change was to delete line 5 from "dataobjectmanager_popup.js", the line that sets the iframe width.

    These changes make it so the width for the nested popup is correctly set via $manager->setPopupWidth().

  • kuenkuen82
    Avatar
    Community Member
    41 Posts

    Re: Set popup width in nested popup window Link to this post

    Thanks PieterV, the JS works quite well. Any tips on how I should increase the height of the popup? In chrome it seems to stick to the bottom

  • Ray
    Avatar
    Community Member
    5 Posts

    Re: Set popup width in nested popup window Link to this post

    For anyone who uses the above posted javascript to fix nested popup widths, please be aware that you'll need to replace all instances of:
    '#srch_fld' to '.srch_fld'
    and
    '#srch_clear' to '.srch_clear'

    as they've changed to classes.

    You'll also need to hack the Headings function in TableListField.php in order to make sorting work properly, but that's a different story...

    2121 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.