7762 Posts in 1289 Topics by 886 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Nested DOM doesn´t work in ModelAdmin
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 102 Views |
-
Nested DOM doesn´t work in ModelAdmin

16 January 2012 at 8:52am Last edited: 16 January 2012 9:18am
Hi everyone,
does someone know about problems with nested DOMs and the ModelAdmin? I like the nested DOM solution from UncleCheese:
http://www.leftandmain.com/silverstripe-screencasts/2010/08/23/nested-dataobjectmanager-a-dom-in-a-dom/So I´ve created an normal DataObject with a nested DOM.
I can create an entry on a page in the sitetree using nested DOMs, but the same doesn´t work in the ModelAdmin.
If I click on 'Add DataObject', I get the right form from the regular DOM but also an list with all nested DOM entries
instead of the message 'You may add 'dataobjectname' once you have saved for the first time.'Further, I can create an entry and it is shown in the list in ModelAdmin, but neighter on the frontend-page nor on the page in the sitetree (in backend) it is listed. That´s very wired, because everything works, if I create an entry via the page in the sitetree.
Hier is my code:
class Workshop extends DataObject
{
//db fields
static $db = array (
'Datum' => 'Date',
'Text' => 'Varchar(255)',
'Trainer' => 'Varchar(255)',
'Kosten' => 'Varchar(255)',
'Status' => 'Varchar(255)'
);//Relations
static $has_one = array (
'WorkshopPage' => 'WorkshopPage'
);static $has_many = array (
'Workshoptrainingsstunden' => 'Workshoptraining'
);//Fields to show in the DOM table
static $summary_fields = array(
'Datum',
'Text',
'Trainer'
);static $default_sort = "Datum ASC";
function IsAuthor() {
$member = Member::currentUserID();
$Anmeldung = DataObject::get('WorkshopAnmeldung');
return ($member == $Anmeldung->AuthorID);
}
//Fields for the DOM Popup
public function getCMSFields()
{
return new FieldSet(
new DateField('Datum'),
new TextField('Text'),
new TextField('Trainer'),
new TextAreaField('Kosten'),
new DataObjectManager(
$this,
'Workshoptrainingsstunden',
'Workshoptraining',
array('Type' => 'Type')
));
}
class WorkshopAnmeldung extends DataObject
{
//db fields
static $db = array (
'Datum' => 'Date',
'Workshops' => 'Varchar(255)',
'Type' => 'Varchar(255)',
'Teilnehmer' => 'Varchar(255)'
);//Relations
static $has_one = array (
'WorkshopPage' => 'WorkshopPage'
);//Fields to show in the DOM table
static $summary_fields = array(
'Datum',
'Workshops',
'Type',
'Teilnehmer'
);static $default_sort = "Datum ASC";
//Fields for the DOM Popup
public function getCMSFields()
{
return new FieldSet(
new DateField('Datum'),
new TextField('Workshops'),
new TextField('Type'),
new TextField('Teilnehmer')
);}
-
Re: Nested DOM doesn´t work in ModelAdmin

16 January 2012 at 9:14am
To make it more puzzling:
On another page I´ve used an DataObjectSet to show the entries of one DataObject and the other DataObject (Workshops) with the nested DOM - On this page the entries, I´ve created with the ModelAdmin, are listed in the list on frontend-page.
BUT anyway on the regular (frontend)-page (Workshops) these entries aren´t listed.
| 102 Views | ||
|
Page:
1
|
Go to Top |

