Disable bulk action button based on checked records
What I am trying to do:
I'm trying to disable a bulk action button when a user selects records that are incompatible with each other. For example, I want to only allow a bulk action with items that belong to the same customer.
What I did:
I tried to use the
disabled()
method with a closure condition on the bulk action.
My issue:
The disabled()
method works, but it isn't reactive and doesn't trigger when table records are selected/deselected. Currently that means the bulk action button shows up (enabled) when one record is selected. If two options that are incompatible are selected the button stays enabled till the button is clicked. At that moment the button starts firing and stops to disable the button.
This would be somewhat acceptable if the button would enable again if the items are compatible again. This functionality the button can never be enabled again till a refresh.
Are there ways to make the button reactive or is it possible to listen for a 'selected' event? It's probably doable by adding custom JS and a custom view, but did I overlook a way without customisation? Thanks!1 Reply
Hi Patrick! Did you find a solution?