1792 Posts in 588 Topics by 560 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2271 Views |
-
Adding a field to the member complexTableField

7 July 2009 at 12:01am
Hello.
I have managed to add an extra field to the member table through a dataobjectdecorator and I have also managed to get it into the member form that you get when you press edit on the complexTableField on the member table.
However I can't find where the fields for the complexTableField are made/added. I would really like to get my dropdown list on the complexTableField since right now you first have to add a member and then edit which is very clumsy/unintuitive.
I must also say that the documentation around modifying the member table is very lacking. A simple tutorial for decorating the member, adding a field to the member form and getting it on the complexTableField would go a long way to helping alot of people when it comes to member modification I think.
Kindly, Marcus.
-
Re: Adding a field to the member complexTableField

17 July 2009 at 10:51am
Hello Smurkas,
I think you managed your new attribute by adding it to the field_names and field_types array which are referenced in the ComplexTableField.
...
$tableField = new ComplexTableField($this, 'Training', 'Training', Training::$field_names, $popupFieldsTraining);
...
class Training ...
static $field_types = array(
'Title' => 'ReadonlyField',
'Category' => 'DropdownField(\'CategoryID\', \'CategoryID\', DataObject::get(\'Category\')->toDropDownMap(\'ID\', \'Title\'))'
);static $field_names = array(
'Title' => 'Training description',
'Category' => 'Category Description'
);
...As you can see in the example, I added a DropDown-list in the ComplexTableField successfully.
Best regards,
chrclaus -
Re: Adding a field to the member complexTableField

14 January 2010 at 2:34pm Last edited: 14 January 2010 2:34pm
Anyone provide a better example of this am trying to add a field to the Members List got it working in the popup but for the life of me can't in the table list.
Any help appreciated.
-
Re: Adding a field to the member complexTableField

14 January 2010 at 9:21pm
I actually figured this out but forgot to report back.
There is a function called addMembershipFields on the MemberTableField class. You can calll it like I do below.
You are however severely limited in what kind of fields you can add since addMembershipFields only takes the fieldname and the title, not what kind of field you want. Because of this you'll always get text fields.You can put the code in the _config.php file.
MemberTableField::addMembershipFields(
array(
"Address" => _t('RTVMemberTableField.ADDRESS', 'Adress'),
"Boras" => _t('RTVMemberTableField.BORAS', 'Borås'),
"Uddevalla" => _t('RTVMemberTableField.UDDEVALLA', 'Uddevalla')
)
);Hope this helps!
-
Re: Adding a field to the member complexTableField

15 January 2010 at 11:33am Last edited: 15 January 2010 11:34am
Hey thanks for the reply I did manage to find that but found the same thing I believe that function is also deprecated as of SS 2.3 my problem is I need a relational dropdown from another dataobject as mentioned the popup has this just not the tablelist see http://www.silverstripe.org/customising-the-cms/show/276815#post276815
| 2271 Views | ||
|
Page:
1
|
Go to Top |


