Reorder plugin
Simple Reorder (Swap) plugin (model items in List view)
Working for big data reorder problem
Swap two items in list, just by clicking on generated button in order
column.
Before you can swap items, you must order by that column (Asc or Desc)
Working with pagination, search and other filters.
Working for simple relations (relation list view - partial)
Not (yet) working if Relation is N-N (BelongsToMany, not working only if sort_order is in pivot table) or Nested (NestedTree) for now
v1.0.2: When you swap items, action first check if sort order in table is valid. If not, order will be fixed (optimized, fixing just problematic order values)
OctoberCMS reorder plugin
Simple OctoberCMS Reorder (Swap) plugin
Swap two items in list, just by clicking on generated button in order
column.
Before you can swap items, you must order by that column (Asc or Desc)
Working with pagination, search and other filters.
Working for simple relations (relation list view - partial)
Not (yet) working if Relation is N-N (BelongsToMany, not working only if sort_order is in pivot table) or Nested (NestedTree) for now
How to enable Swap button in order column:
In backend Controller of your plugin ({yourPlugin}/controller/{nameOfController}.php),
in $implement
array add Reuniors\Reorder\Controllers\OrderSwapController
, example:
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController', 'Backend\Behaviors\RelationController', 'Reuniors\Reorder\Controllers\OrderSwapController' ];
In your Models list yaml ({yourPlugin}/model/{nameOfModel}/{list}.yaml) of your main or relation list
just set type of your order type: reorder_button
example:
sort_order: label: 'Sort' type: reorder_button
That is it, you should now see buttons with order value instead of just text, and you must order by that column to enable Swap button. When you click on Swap (when hovers on order column value) button, button becomes Cancel Swap, and Cancel Swap button is added in toolbar (Cancel Swap: {order_value})
-
This plugin has not been reviewed yet.
-
1.0.2 |
Added sort column check and autofix Dec 26, 2020 |
---|---|
1.0.1 |
Initialize plugin. Dec 22, 2020 |