5099 Posts in 1519 Topics by 1116 members
|Go to End|
28 September 2011 at 10:43pm
i have a DataObject which is managed by ModelAdmin via the cms, so far so good. But all objects that are related to this with a $has_one relation are only shown as DropDownField with the id. How can i customize this to change the DrowDown to other fields from the managed object?
Thanks a lot for your help!
28 September 2011 at 11:36pm
Welcome to the forums!
I'm not sure what you mean by "How can i customize this to change the DrowDown to other fields from the managed object". Since this is a relationship within the datamodel you are restricted to what can be used... the option I think that might help is the ItemPicker...
Also in the situation I what the information edittable after it has been selected I use this...
Hope this helps
29 September 2011 at 12:07am
Thanks for your quick reply!
To clarify it a bit, i have made a screenshot where you can see two DropDownFields with only an id from the relation in it. And i want to change this to another field from the related object.
29 September 2011 at 12:19am
Where the system is trying to scaffold the drop down it looks for a "Name" field. If you add that then it will look a bit better.
Alternatively - you could redraw the drop down with the right "Name" (within getCMSFields)
$dos = DataObject::get($strDataObjectName);
$map = $dos ? $dos->toDropdownMap('ID','Name') : array(); //change Name in this line
29 September 2011 at 12:41am
Thanks a lot, it works great!
I had already found the replaceField method but now it ist clear to me how to use it!
|Go to Top|