Trigger delete action on custom layout for table

Hi, I'm trying to render a resource that contains only images as an image gallery. I've made a custom ListRecords view, where I'm displaying the records in my custom layout:
@foreach ($this->table->getRecords() as $key => $record)
{{-- @dd(get_class_methods($record)) --}}
<div class="overflow-hidden aspect-square">
<button type="button" wire:loading.attr="disabled"
wire:click="mountTableAction('delete', {{ $key + 1 }})">Delete</button>
<img src="{{ asset($record->portfolio_image) }}" alt="" class="w-full h-full object-cover">
</div>
@endforeach
@foreach ($this->table->getRecords() as $key => $record)
{{-- @dd(get_class_methods($record)) --}}
<div class="overflow-hidden aspect-square">
<button type="button" wire:loading.attr="disabled"
wire:click="mountTableAction('delete', {{ $key + 1 }})">Delete</button>
<img src="{{ asset($record->portfolio_image) }}" alt="" class="w-full h-full object-cover">
</div>
@endforeach
I'm trying to get the delete action to work. I've copied what I see on the markup from the other resource's delete action button. I see that I'm triggering a request through the network when clicking the delete button on my custom layout, but I don't get any kind of delete confirmation modal and the record doesn't delete. I've tried passing the record id, the key without + 1, read through the vendor files but can't seem to figure it out. How can I delete the records? Thanks!
1 Reply
Kanalaetxebarria
KanalaetxebarriaOP13mo ago
Found the issue: had to include
<x-filament-actions::modals />
<x-filament-actions::modals />
at the bottom of the custom page.
Want results from more Discord servers?
Add your server