This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

MarSch
MarSch

Hello, i have a little problem with a dependency in component Inspector. With defineProperties() i have defined the properties for Inspector like this ...

public function defineProperties()
{
    return [
            'modelClass' => [
                'title'       => 'marsch.frontendforms::lang.components.list_model',
                'type'        => 'dropdown',
                'showExternalParam' => false
            ],
            'columns' => [
                'title'       => '...',
                'description' => '...',
                'type'        => 'objectList',
                'titleProperty' => 'label',
                'itemProperties' => [
                    [
                        'property' => 'modelClass',
                        'title'       => '...',
                        'type'        => 'dropdown',
                        'showExternalParam' => false
                    ],
                    [
                        'property' => 'label',
                        'title' => '...',
                        'type' => 'string'
                    ],
                    [
                        'property' => 'name',
                        'title' => '...',
                        'type' => 'dropdown',
                        'depends'     => ['modelClass'],
                        'placeholder' => 'select db-colum'
                    ],
                    [
                        'property' => 'type',
                        'title' => '...',
                        'type' => 'dropdown',
                        'default' => 'notype',
                        'options' => [
                            'notype' => '- no type -',
                            'text' => 'Text',
                            'number' => 'Number',
                            'switch' => 'Switch',
                            'datetime' => 'Date & Time',
                            'date' => 'Date',
                            'time' => 'Time',
                            'timesince' => 'Time since',
                            'timetense' => 'Time tense',
                            'select' => 'Select',
                            'relation' => 'Relation',
                            'partial' => 'Partial'
                        ]
                    ],
                    [
                        'property' => 'defaults',
                        'title' => '...',
                        'type' => 'string'
                    ],
                    [
                        'property' => 'searchable',
                        'title' => '...',
                        'type' => 'checkbox',
                        'default' => false
                    ],
                    [
                        'property' => 'invisible',
                        'title' => '...',
                        'type' => 'checkbox',
                        'default' => false
                    ],
                    [
                        'property' => 'sortable',
                        'title' => '...',
                        'type' => 'checkbox',
                        'default' => true
                    ],
                    [
                        'property' => 'clickable',
                        'title' => '...',
                        'type' => 'checkbox',
                        'default' => true
                    ],
                    [
                        'property' => 'cssClass',
                        'title' => '...',
                        'type' => 'dropdown',
                        'options' => [
                            'empty' => 'normal',
                            'strike' => 'strike',
                            'frozen' => 'frozen',
                            'processing' => 'processing',
                            'negative' => 'negative',
                            'positive' => 'positive',
                            'disabled' => 'disabled',
                            'new' => 'new',
                            'safe' => 'safe'
                        ]
                    ],
                ]
            ],
    ];
    }

For the dropdownfield name in columns objectlist i have defined a dependency from property modelClass. This is working as long as i define the field/property modelClass a second time inside the columns objectlist. How i can i get the dependency working if the field modelClass is only defined on top? I think the problem here is that objectlist is opened by a modal popup...

The dropdown options for the name field i have defined like followed:

public function getNameOptions()
 {
    return ComponentHelper::instance()->listModelColumnNames();
 }

Anyone an idea?

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.