How to get the deselect item on SelectColumn with multiple options.

Is it possible that get the deselect item on multiple select options. With afterStateUpdate method
13 Replies
Patrick Boivin
Patrick Boivin7mo ago
Do you want to get a list of the items that were deselected, after clicking the Deselect action?
Asmit Nepali
Asmit NepaliOP7mo ago
Ya, I want exactly that
Patrick Boivin
Patrick Boivin7mo ago
I'm curious to know more about your use case.
Asmit Nepali
Asmit NepaliOP7mo ago
I have a select field with multiple, I can select multiple options, If I deselect one of them, then I want that deselected Item data
Patrick Boivin
Patrick Boivin7mo ago
Sure, I understand what you want to do. I'm curious to know why. What do you want to do with the information of the deselected items?
Asmit Nepali
Asmit NepaliOP7mo ago
Here the Admin have predefine set of permission, In this dropdown If I choose Admin on roles then it auto fill Permission with associated permission, if I remove the one of the Permission then it also remove the Admin as well this my use case
Patrick Boivin
Patrick Boivin7mo ago
Interesting, thanks. I wonder if you could use Livewire's updating and updated hooks for this : https://livewire.laravel.com/docs/lifecycle-hooks#update In updating, you would have access to the current permissions and the new permissions being updated. I just realized that afterStateUpdated() can also give you the old value of the field. Something to try. https://filamentphp.com/docs/3.x/forms/advanced#field-updates
Asmit Nepali
Asmit NepaliOP7mo ago
For select it return the current state
krekas
krekas7mo ago
have you checked the docs link? There is a ?string $old inject
Asmit Nepali
Asmit NepaliOP7mo ago
Ya checked
krekas
krekas7mo ago
But I wonder why even allow to select permissions?
Asmit Nepali
Asmit NepaliOP7mo ago
If user want to other individual permission, then they can choose from the permission dropdown
krekas
krekas7mo ago
Hm. Why not show permissions that aren't attached to selected role?
Want results from more Discord servers?
Add your server