Skip to content

Drag to reorder table rows #2370

@giant-robot

Description

@giant-robot

It is not an uncommon need to be able to reorder rows in a table layout. Since SortableJS is already a project dependency, it shouldn't be too hard to implement

I have put together a proof of concept that enables the feature with the minimum amount of changes in the platform.

It introduces a new action that can be added to a dedicated column. This is an example applied to the RoleListLayout:

public function columns(): array
{
    return [
        TD::make()
            ->cantHide()
            ->render(function (Role $role) {
                return ReorderHandle::make()
                    ->method('reorder')
                    ->key($role->getKey());
            }),

        ...
    ];
}

Not sure this is the best way to go about it, though. Thoughts?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions