Hello,
I am trying to sort the items inside a relation manager
the config_relation.yaml is
blocks:
label: Blocks
view:
list: $/my/blocks/models/blocksincms/columns.yaml
toolbarButtons: create|add|remove|reorder
manage:
form: $/my/blocks/models/blocksincms/fields.yaml
recordsPerPage: 20
but for some reasons i cannot add the reorder button to the toolbar. if i add “reorder” as above i am getting error
The partial '_button_reorder' is not found.
which is understandable.
the following is my controller
public $implement = [
'Backend\Behaviors\ListController',
'Backend\Behaviors\FormController',
'Backend\Behaviors\RelationController',
'Backend\Behaviors\ReorderController'
];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $reorderConfig = 'config_reorder.yaml';
public $relationConfig = 'config_relation.yaml';
after digging a while i understand the relationManager does not supports reordering. am i right or i am missing something?
thank you in advance.
There is an article on sorting related records here:
1 Like
@daftspunky thankyou. it isn’t working good becasue it says the
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'my_cmsblocks_list_to_cms.sort_order'
the belongsToMany is
'blocks' => [
CmsBlock::class,
'table' => 'my_cmsblocks_list_to_cms',
'key' => 'entity_id',
'pivotSortable' => 'sort_order',
],
The column is also present in the database table in the pivot table
the config_relation.yaml is
blocks:
label: Blocks
structure:
showReorder: true
showTree: false
view:
list: $/my/cmsblocks/models/cmsblock/columns.yaml
toolbarButtons: create|delete
manage:
form: $/my/cmsblocks/models/cmsblock/fields.yaml
recordsPerPage: 20
is there anything i am doing wrong?
thanks in advance
@daftspunky well finds the answer
Note: Pivot data is not supported by deferred bindings at this time, so the parent model should exist. If your relation behavior config has deferredBinding: true, the pivot data will not be available to use in the list configuration (ex.pivot[attribute]).
in this case the defered binding should be false which will leads to many problems in the future, Looking forward for this Feature 
thanks alot.
1 Like
Yes, the code is there, but we had to disable it because it is too unreliable! Thanks for reporting back with the workaround.