How to open modal by clicking table column?
As a developer, I'm using Filament for my project and want to open the modal by clicking the table column, how can I do it?
Thank you!
Tables\Columns\IconColumn::make('video_interview_url')
->label('Video')
->icon('heroicon-o-video-camera')
->action(),
20 Replies
Personally I used the ViewColumn feature and built a livewire component to use a button within the cell which triggers a showModal() method and then the blade injection function $getRecord(). Not sure if this is the most ideal way but it worked for my purpose š
š
Thanks for your advice!
And I used livewire component:
Tables\Columns\IconColumn::make('video_interview_url')
->label('Video')
->icon('heroicon-o-video-camera')
->action(
Action::make('campaing-video')
->modalContent(view('livewire.campaign-video'))
)
I'm now trying to pass column data to show it in modal
Looks like this could be useful (from docs) but not tried it:
#Passing data to the custom modal content
You can pass data to the view by returning it from a function. For example, if the $record of an action is set, you can pass that through to the view:
use Illuminate\Contracts\View\View;
Action::make('advance')
->action(fn (Contract $record) => $record->advance())
->modalContent(fn (Contract $record): View => view(
'filament.pages.actions.advance',
['record' => $record],
))
Awesome!
I've used below code, but how to use the parameters in livewire component?
this is livewire.php
and this is livewire.blade.php
Unfortunately, it is not working, how can I use the data passed in the livewire component?
Thanks.
Have you tried using the $getRecord() method in your blade file? I know this works with a ViewColumn but not tried in conjunction with modalContent. If it works you shouldn't even need to use the callback in modalContent
Could you please send me sample code? š š
So the view I passed pointed to a livewire button component and using wire:click I passed the $getRecord()->id to the popUpModal method on my Table component and saved it to a selectedRecordId variable that I could pass back to the modal within my table blade component
DD on the get record method and see if you can get anything back from it at all
Ok I will try it
Thanks for your support!
You are senior developer!!!
Good news!
I did it like below:
We can just the $record directly in blade.php
Anyway, I'd appreciate your support!
Excellent news. Nice work. Now you're the senior developer š
š¤£
š
I'd like to see you if you don't mind when you are available
Can we have the video call when you are available?
I'm a Laravel/Vue developer from Hongkong, and you?
I work in cybersec in the UK so our timezones may be a bit out!!
I'm working with a US client so I'm working now in the EST timezone
Don't worry about the timezone, and just asking so let me know if you are ready
Have a good evening!
Ok cool. You too mate and speak soon
PS: do you know mimul.js?
No I'm afraid not
Ok, good luck!
Hi @tommythecoat
Sorry but can you help me one thing?
Do you know many to many relationship?