Hi, I would appreciate any advise in this:
I have a page which has a relation with two DataObjects
class MobilePage extends Page {
static $db = array(
);
static $has_many = array(
'MyBrand' => 'MobileBrand',
'MyModel' => 'MobileModel'
);
For each dataobject i have a separate tab in CMS with ComplexTableField in which I'm able to add/edit/remove new objects.
Then it is more complicated, one of these dataobjects is related to another one:
class MobileBrand extends DataObject {
static $db = array(
'BrandName' => 'Text'
);
static $has_many = array(
'MyModel' => 'MobileModel'
);
So as you can see, the brand object can have many model objects.
Now, in ComplexTableField for mobile brands I'm able to write out all the models that are related to this brand using custom getter. What I would like to achieve is, that each listed model name would be a link to the popup window where I can edit this model. I'm trying to use the link from the models ComplexTableField:
$link = '<a href="admin/?executeForm=EditForm&flush=1&action_callfieldmethod&fieldName=MyModel&ctf[ID]='.$parent_id.'&ctf[childID]='.$model->ID.'&ctf[start]=0&methodName=show" target="_blank">'.$model->ModelName . "</a> ";
Though this is not working as expected and everytime a click on any model I get the first one listed. If I try to use pagination and move forward and then backward I'm eventually able to find the model I wanted to edit. I'm apparently missing something here.
Or is there any better way to achieve this functionality?
Cheers..