21491 Posts in 5783 Topics by 2622 members
General Questions
SilverStripe Forums » General Questions » [SOLVED] - ModelAdmin and a DataObject with many files
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1111 Views |
-
[SOLVED] - ModelAdmin and a DataObject with many files

2 June 2010 at 4:06am Last edited: 6 June 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 -
Re: [SOLVED] - ModelAdmin and a DataObject with many files

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
-
Re: [SOLVED] - ModelAdmin and a DataObject with many files

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 -
Re: [SOLVED] - ModelAdmin and a DataObject with many files

8 June 2010 at 12:24am
Kleine Ergänzung - CSS reicht:
public function init() {
parent::init();
Requirements::customCSS("#ModelAdminPanel {overflow:auto;}");
} -
Re: [SOLVED] - ModelAdmin and a DataObject with many files

3 March 2012 at 2:10am
why hasnt this been applied to the latest SS versions? it seems like a pretty obvious bug.
-
Re: [SOLVED] - ModelAdmin and a DataObject with many files

3 March 2012 at 4:38am Last edited: 3 March 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
| 1111 Views | ||
|
Page:
1
|
Go to Top |




