Skip to content

Add Grid bulk action methods#1920

Merged
mvorisek merged 44 commits intoatk4:developfrom
mhuser:fix-1727-bind-modal-and-grid-addSelection
Sep 4, 2023
Merged

Add Grid bulk action methods#1920
mvorisek merged 44 commits intoatk4:developfrom
mhuser:fix-1727-bind-modal-and-grid-addSelection

Conversation

@mhuser
Copy link
Copy Markdown
Contributor

@mhuser mhuser commented Oct 28, 2022

fix #1727

This PR aims to add the bulk action feature to process a selection or multiple records in Grid. Currently it is easy to perform an operation:

  1. on a single record e.g. with addModalAction()
  2. on the whole grid e.g. with $grid->menu->addItem())

It is complex to work with the results of $grid->addSelection() outside writing verbose code with static modals and a hidden field.

// Executing a modal on a bulk selection
$callback = function ($m, $ids) use ($grid) {
if (!$ids) {
Message::addTo($m, [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Build action button should be disabled instead when nothing is selected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nice idea. have you an example of such magic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe the master checkbox code could enable/disable bulk action button by querying a dedicated class

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Wait on #1921 in the meantime, the action will return a void array, then iterating through it will do nothing.

@mvorisek mvorisek changed the title Add addModalBulkAction() to process a selection of rows in a Grid Add Grid::addModalBulkAction() method May 29, 2023
@mhuser
Copy link
Copy Markdown
Contributor Author

mhuser commented Aug 15, 2023

Maybe there is an interest to addBulkAction too, that would fire without Modal.

@mhuser mhuser marked this pull request as ready for review August 15, 2023 18:34
@mvorisek mvorisek changed the title Add Grid::addModalBulkAction() method Add Grid bulk action methods Sep 4, 2023
@mvorisek mvorisek merged commit 01ef91e into atk4:develop Sep 4, 2023
@mvorisek
Copy link
Copy Markdown
Member

mvorisek commented Sep 4, 2023

Quality PR, thank you!

@mhuser mhuser deleted the fix-1727-bind-modal-and-grid-addSelection branch September 4, 2023 20:22
@mhuser
Copy link
Copy Markdown
Contributor Author

mhuser commented Sep 4, 2023

Quality PR, thank you!

Great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Execute php callback on Grid->addSelection() for multiple selection

2 participants