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

[SOLVED] - ModelAdmin and a DataObject with many files


Go to End


6 Posts   2283 Views

Avatar
toddmkimball

Community Member, 13 Posts

2 June 2010 at 4:06am

Edited: 06/06/2010 1:02am

Has anyone had any luck with the ModelAdmin generating an interface for a DataObject with more than one file field?

code so far:

class FeaturedInitiatives extends DataObject 
{
    static $db = array (
		'Title' => 'Text',
		'Description' => 'HTMLText'
	);
 
	static $has_one = array (
		'Thumb' => 'File', 
		'ShadedThumb' => 'File', 
		'MainImage' => 'File'
	);
 
	public function getCMSFields()
	{
		return new FieldSet(
			new TextField('Title'),
			new HTMLEditorField('Description'),
			new FileIFrameField('Thumb'), 
			new FileIFrameField('ShadedThumb'), 
			new FileIFrameField('MainImage')
		);
	}
}

The UI, after saving an object, lacks and scrollbar and only displays a single file field.
Also, I tried this with ImageFields and had no luck either.

Regards,
Todd

Avatar
swaiba

Forum Moderator, 1899 Posts

2 June 2010 at 8:27pm

Hi Todd,

I cannot explain it, but I can fix it for you... (assuming you use ss 2.4.0 as I have tested with that)

add this to your YourModelAdmin.php :-

public function init()
{
	parent::init();
	Requirements::javascript('mysite/javascript/modeladmin.js');
}

this is the contents of mysite/javascript/modeladmin.js :-

jQuery('#ModelAdminPanel').css('overflow', 'auto');

Barry

Avatar
toddmkimball

Community Member, 13 Posts

6 June 2010 at 1:01am

Thanks Barry, that worked as stated and solved the issue. Why didn't I think of that...

Regards,
Todd

Avatar
adiwidjaja

Community Member, 14 Posts

8 June 2010 at 12:24am

Kleine Ergänzung - CSS reicht:

    public function init() {
        parent::init();
        Requirements::customCSS("#ModelAdminPanel {overflow:auto;}");
    }

Avatar
CHD

Community Member, 219 Posts

3 March 2012 at 2:10am

why hasnt this been applied to the latest SS versions? it seems like a pretty obvious bug.

Avatar
swaiba

Forum Moderator, 1899 Posts

3 March 2012 at 4:38am

Edited: 03/03/2012 4:39am

http://groups.google.com/group/silverstripe-dev/browse_thread/thread/1676366a087164c5#

seemed aproriate as I got this email in the digest at the tiem of reading this