orchidsoftware / orchidsoftware/platform

Drag to reorder table rows

Open
#2,370 4 comments 1 reaction 1 assignee View on GitHub

@tabuna is already working on this.

Since Sep 16, 2022.

Dominant language
PHP
Stars
4.8k
Forks
662
Avg merge
1d 9h
Merged PRs (30d)
7

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.