Is it possible to enable particular component during view?
I have tried to do
disabled(false)
but the component remains disabled. Is it possible to override this in a view?
18 Replies
its not possible to override on a view page. theres no way to save the data anyway
Hm, then the other question - Is it possible to change something when e.g. user toggles on Toggle button? I mean without pressing save button but on change event.
So I have the following use-case where I do save on after state updated, and would love to allow user to do this single change on view.
So I thought that
disabled(false)
should act as an inverse but can't find any use of conditional if this is not followed.yes, but if the button isnt movable then it wont work
so maybe I am better to have a custom action here but not exactly sure how to pass an existing form schema into the modal. :/
ViewAction::make()
you dont need any of this
ViewAction::make()->disableForm(false)
I have tried disabledForm before writing but it did not work for some reason :/
I have even gone to source code to comment out $this->disableForm() but it looks like the disable is coming from somewhere else
Edit page got my toggle enabled so this is not a form
is this a modal or a page
edit is page, and view is modal
i dont know then
something doesnt make sense here
That's what I have and toggle is disabled in the modal view :/
I also did fresh filament install just in case
but when I do this toggle is enabled
Also, if I set
form
then toggle is not disabled. I just can't find where ViewAction loads the form data from, maybe there is something that keeps ignoring the disableForm(false)
Yeh, so this is in the ListRecord, and gets disabled ViewForm for ViewAction by default so the disableForm has no effect.
override it then
Yeh, I did this. Finally got things to work, not as nicely though. 🙂
if i were you, forget about all this and just do an action button instead of trying to hack the form to not be disabled
By the way, do you know if it's possible to have action called on table row click? I thought to use View to easily override this but I guess when I use modal it's not a case anymore.
yeah we call view by default or edit if view doesnt exist
but you can override getTableRecordAction()
oh, I will give a shot ... two days till we go live on the biggest arena in Lithuania with the startup, so many questions to finalise bits, thanks.
looks to work, just not sure about the
form
part, looks a bit hacky@danharrin I have just opened a PR that allows ViewAction to respect disableForm(false) param.
https://github.com/filamentphp/filament/pull/6381
GitHub
Respect disableForm(false) for ViewAction by linaspasv · Pull Reque...
The following PR allows to override disableForm setting on a ViewAction.
Tables\Actions\ViewAction::make()->disableForm(false)