i have managed to put form and list in the same page by reviewing this but after data insert to database, it did not show in the list i have implement these to controller
public $implement = [
'Backend\Behaviors\ListController',
'Backend\Behaviors\FormController',
'Backend\Behaviors\RelationController'];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $relationConfig = 'config_relation.yaml';
and set config for relation
jabatans:
label: 'Jabatan'
manage:
form: $/mismaiti/mywarta/models/jabatan/relation_fields.yaml
list: $/mismaiti/mywarta/models/jabatan/relation_columns.yaml
view:
list: $/mismaiti/mywarta/models/jabatan/relation_columns.yaml
toolbarButtons: create|delete
and create relationship to parent model
public $hasMany = [
'jabatans' => [
'Mismaiti\MyWarta\Models\Jabatan',
'key' => 'jabatan_id',
'otherKey' => 'id'
]
];
and to child model
public $belongsTo = [
'jabatan' => [
'Mismaiti\MyWarta\Models\WartaDataAtribut',
'key' => 'jabatan_id'
]
];
child form relation_field.yaml
fields:
id:
label: ID
span: left
oc.commentPosition: ''
hidden: 1
type: number
jabatan:
label: 'Fungsi/Jabatan dalam Pelayanan'
span: right
oc.commentPosition: ''
type: text
parent form parentfield.yaml
fields:
jabat:
label: 'Data Jabatan Pelayan'
span: left
type: section
jabatans:
label: ''
span: left
type: partial
path: ~/plugins/mismaiti/mywarta/controllers/wartadataatribut/_jabatans.htm
it works with the form but when i insert data to child model and save it.. the data did not show in the list.. am i missing something..