Custom Action on custom column.
Hello everyone,
Is there any way to add custom action on custom column:
It shows the button but not trigger the modal why ?
15 Replies
Any Idea ?
why not just use an Action?
Hey @LeandroFerreira, thanks for the reply!
My use case is: I have a column, and if there's no value in it, I want to show a + icon. When the user clicks that icon, a modal should open. Do you have any suggestions on how I can achieve this?
Thanks again
You could add an action to a livewire component
https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component#adding-the-action
Then, you can inject the component using a custom column
Thanks @LeandroFerreira! I’ll give this a try and let you know how it goes. Appreciate the help!
Hi @LeandroFerreira I tried implementing a custom action on my IconActionColumn, but I’m a bit stuck on how to pass the action to a Livewire component. Here’s what I have:
Livewire
Property type not supported in Livewire for property: [{}]
How can I correctly pass the action to the Livewire component?What is is you are trying to do? If you want an action just use:
or
if it's an action without model, what I use to download media from a record:
@toeknee Thank you for the reply! Actually, what I’m trying to do is this,
If a column has no data, I want to display an icon as an empty state. When the user clicks that icon, it should open a modal to input and save some data. After saving, if the user wants, they should also be able to add more of these “empty” actions.
Yeah that's easy enough with the default icon action
like?
Thanks @toeknee I think this will work for now.
One more thing, can you suggest me how can we pass the Action as parameter on livewire
You would pass it as normal, if it's defined on the livewire component you just render it as normal.
While try to pass as normal,
Property type not supported in Livewire for property: [{}]
You are probably passing the action object... which you can't pass like that. The action should be defined on the component you are passing too, just set a value to trigger it rendering.
You are right I passed the action object,
you mean I have to register action on my Listpage and then call it from my custom livewire component.
No the action should be registered on your cusotm livewire component? Then you trigger it with the method