Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

How to Increase has_many popup box (GreyBox?) size?


Reply


7 Posts   2301 Views

Avatar
swaiba

Forum Moderator, 1808 Posts

6 August 2010 at 9:37pm

Hi,

I have a DataObjectParent with a has_many relation to another DataObjectChild. This, as a managed_model in ModelAdmin, creates a table where I can "Add DataObjectChild" and it pops up a window with the form. I think in a 'GreyBox'.

Is there any way to set the default size a bit larger?

Barry

Avatar
mattclegg

Community Member, 56 Posts

17 August 2010 at 11:43pm

This is a really simple change, and I dont know why by default the popup is soo tiny?

Open sapphire/thirdparty/greybox/greybox.js
change line 214 tobe;

GB_ONLY_ONE.setFullScreen(true);

Enjoy full sized popups from any ComplexTableManager ie ModelAdmin/Security

Avatar
klikhier

Community Member, 150 Posts

15 October 2010 at 9:16pm

Thanks for this info! Is there a way this can be done without hacking the core. Something like set_popup_width() in Dataobject Manager module?

Avatar
swaiba

Forum Moderator, 1808 Posts

17 November 2010 at 11:48pm

I've found a nice way to do this... in MyLeftAndMainDecorator (that I use for stuff needed int eh CMS) add some script...

class MyLeftAndMainDecorator extends LeftAndMainDecorator {
function init() {
Requirements::customScript("GB_show = GB_showFullScreen;");
}
}

(needs "Object::add_extension('LeftAndMain', 'MyLeftAndMainDecorator');" in _config.php)

Avatar
Tony C

Community Member, 9 Posts

9 March 2011 at 11:55am

That has a SIDE EFFECT of not refreshing the main panel because the javascript has the wrong no. of params and doesn't call the callback_fn.

The decorator is the right way to do it though, but it needs to be ....

class MyLeftAndMainDecorator extends LeftAndMainDecorator {
   function init() {
      
      $custom = <<<JS
       GB_show = function(caption, url, /* optional */ height, width, callback_fn) {
       GB_initOneIfNeeded();
       GB_ONLY_ONE.defaultSize();
       GB_ONLY_ONE.setFullScreen(true);
       GB_ONLY_ONE.setType("page");
       GB_ONLY_ONE.setCallback(callback_fn);
       GB_ONLY_ONE.show(caption, url);
       return false;
      };
JS;
      
      // Requirements::customScript("GB_show = GB_showFullScreen;");
      Requirements::customScript( $custom );
   }
}

Avatar
swaiba

Forum Moderator, 1808 Posts

9 March 2011 at 10:11pm

Many thanks Tony for the tip!

Avatar
SheaDawson

Community Member, 46 Posts

18 July 2011 at 8:49pm

That is infinitely better. Thanks guys!