Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show bulk actions below table #13530

Open
wants to merge 6 commits into
base: 3.x
Choose a base branch
from

Conversation

howdu
Copy link
Contributor

@howdu howdu commented Jul 10, 2024

Description

Add option to display bulk actions below table

->bulkActions([
])
->bulkActionsPosition(Tables\Enums\BulkActionsPosition::BelowTable)

Visual changes

Screenshot 2024-07-10 at 13 38 58 Screenshot 2024-07-10 at 13 35 58

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@zepfietje zepfietje added the enhancement New feature or request label Jul 12, 2024
@zepfietje zepfietje added this to the v3 milestone Jul 12, 2024
@danharrin danharrin requested a review from zepfietje July 15, 2024 14:46
@danharrin
Copy link
Member

@zepfietje would appreciate the green light on the design before I proceed into the code please

@zepfietje
Copy link
Member

Personally I don't think having the actions at the bottom results in a good UI/UX.
Could you clarify your reasoning here, @howdu?

@zepfietje zepfietje removed their request for review July 19, 2024 07:40
@howdu
Copy link
Contributor Author

howdu commented Jul 19, 2024

@zepfietje it was a client who requested it - their reasoning was they work their way down the table selecting all the relevant records and always finish at the bottom where they wanted the action button instead of having to scroll to the top.

The table is implemented as a checklist where they need to work through all the rows selecting all the relevant records at once.

@zepfietje
Copy link
Member

Hmm, I'm wondering if the bulk select checkbox and select/deselect actions should be in the footer too then?

@howdu
Copy link
Contributor Author

howdu commented Jul 21, 2024

@zepfietje I've added this above the action let me know what you think.
Screenshot 2024-07-21 at 07 45 37

Screenshot 2024-07-21 at 07 45 54

Also added the option to display both above and below table. You can get clever with not displaying this on a small tables.

->bulkActionsPosition(
    fn (Table $table) => $table->getRecords()->count() > 5
        ? Tables\Enums\BulkActionsPosition::AboveAndBelowTable
        : Tables\Enums\BulkActionsPosition::AboveTable
)

@@ -1250,6 +1254,36 @@ class="fi-ta-record-checkbox"
@endif
</div>

@if ($hasBulkActionsBelowTable && (! $isReordering) && count($bulkActions))
<div
Copy link
Member

@zepfietje zepfietje Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to minimize duplication here and in the header?
Maintenance of the table index view is already very hard, so I don't want to introduce additional complexity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zepfietje please let me know what changes you think best to improve this.

Perhaps using capture blade directive? But due to it not including the reorder action in the footer I think the selection-indicator and bulk actionfilament-tables::actions would need to be captured separately?

@zepfietje
Copy link
Member

@howdu, shouldn't it also show the bulk selection checkbox?
It should be identical to what's in the header, right?

@howdu
Copy link
Contributor Author

howdu commented Jul 28, 2024

@zepfietje I think adding the bulk checkbox would overcomplicate this. I was trying to keep it simple and work the same as filter position above/below.

@zepfietje
Copy link
Member

Alright, I understand now since the bulk selection checkbox is in the column headers row.
What does this PR look like when positioning bulk actions and filters in the footer of the table, @howdu?

@howdu
Copy link
Contributor Author

howdu commented Aug 9, 2024

@zepfietje it displays above the pagination so doesn't affect that.

Screenshot 2024-08-09 at 14 03 39 Screenshot 2024-08-09 at 14 04 43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants