22399 Posts in 6747 Topics by 2749 members
General questions about getting started with SilverStripe that don't fit in any of the categories above.
|Go to End|
25 January 2011 at 12:48am
Hello out there,
I have the following question:
I have 3 classes
One Page called “Saison”
Two DataObject called “Spiel” and “Punkt”
The relations are:
One “Saison” has_many “Spiel”
One “Spiel” has one “Saison”
One “Spiel “ has many “Punkt”
One “Punkt” has one “Spiel”
I want to add “Spiel” and “Punkt” via the CMS. I added a ComplexTableField to “Saison” to edit the “Spiel” records. This works fine I can create, edit and delete “Spiel” records.
If I click on one of these “Spiel” records a Popup-appears with two tabs “Main” and “Punkt” in Main I can edit the “Spiel” Record.
In the Tab “Punkt” I can just see the existing “Punkt” records.
Is there a possibility to add new “Punkt” records in this Tab?
This would be a very nice solution
See the attachment for a screenshot
25 January 2011 at 3:34am
possibly need to make the CTF yourself... something like...
$cos = $this->Spiel();
$ctf= new HasManyComplexTableField($this,'Punkt','Punkt',null,null,'ID IN ('.implode(',',$cos->getIdList()).')');
$ctf->Markable = false;
25 January 2011 at 4:23am
thanks for the quick reply,
one question on your code:
what is $cos = $this->Spiel() doing ?
there is no "Spiel()" function in this class...
I tried this code without the $cos variable and there is still no "add" link in the TableField
I just read the permission-array by $ar = $ctf->getPermissions(); the permissions are set like in your code..
25 January 2011 at 4:27am Last edited: 25 January 2011 4:28am
>> what is $cos = $this->Spiel() doing ?
when you define a relationship like has_one or has_many (many_many is different I think) you can use the relationshipname as a function to return the componet/componetset (like a dataobjectset but a couple more functions).
sorry I can't help more - perhaps if you made your code into minimum required to reproduce the issue...
25 January 2011 at 5:39am Last edited: 25 January 2011 5:40am
thanks for you reply, sure you can have a look on the code this isn´t top secrect project for the NASA but I just copied you code
now it´s getting tricky
I just looked on the code of the dialog, there you will find the add button, but you can´t see the button
here is a little snippet from the code:
<input id="ComplexTableField_Popup_DetailForm_Strafe_PopupHeight" value="390" disabled="disabled" type="hidden">
<input id="ComplexTableField_Popup_DetailForm_Strafe_PopupWidth" value="560" disabled="disabled" type="hidden">
<a style="display: none;" class="popuplink addlink" href="admin/EditForm/field/Spiel/item/1/DetailForm/field/Strafe/add?SecurityID=5d98310200969de2002bd585b34f2e0f627f5548&SecurityID=5d98310200969de2002bd585b34f2e0f627f5548" alt="add"><img src="cms/images/add.gif" alt="%s hinzufügen">
<% sprintf(_t('ADDITEM', 'Add %s', PR_MEDIUM, 'Add [name]'),Strafe) %>
|Go to Top|