Adding 'confirmation modal' to a checkbox?
I feel like I'm missing something simple in the docs in regards to action modals.
Is there a way to add a 'are you sure you want to toggle this checkbox' style of modal to a checkbox field? Something that would pop up with a confirmation before ->updateStateUsing() is called?
I'm using a table builder checkbox colum
8 Replies
This works at a row level, but I cannot get the same functionality to work for the specific checkbox column.
What about.... outputting a notification on check, which has an undo action. This will mean you are not overloading your table with extra un-needed html
I like the idea, a lot actually, but in this specific case I would rather use the modal in this case to prevent having to store/save any previous state.
Instead of an checkbox.. can you do an icon column?
Another great idea. I attempted the IconColumn, however when I use action ->visible and ->hidden seem to be per-row and not per-column in regards to column actions.
Another requirement I suppose is that I can conditionally control actions on the column when clicked.
I was doing this using ->updateStateUsing() and ->afterStateUpdated() which are available on the CheckboxColumn
Maybe just make your own Checkbox Column field which extends and allows modals?
Going to look into that as an option. A bit outside of my skillset, but ready to tackle it.
Thank you @toeknee
I screwed up the naming of the action. I had it in a loop and I was overriding it which is why my ->visible and ->hidden were not working.
Your idea regarding the IconColumn was fantastic and is going to work perfectly now that I've learned to debug Actions. lol.
Thank you for taking the time and throwing out those ideas @toeknee and helping me solve this.
Fantastic, very welcome!