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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

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


Go to End


7 Posts   3621 Views

Avatar
swaiba

Forum Moderator, 1899 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, 1899 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, 1899 Posts

9 March 2011 at 10:11pm

Many thanks Tony for the tip!

Avatar
sheadawson

Community Member, 49 Posts

18 July 2011 at 8:49pm

That is infinitely better. Thanks guys!