I have a custom table component like this:
<table>
<tbody>
@foreach ($rows as $row)
<tr>
@foreach ($row as $cell)
<td>
@endforeach
@isset($actions)
<td>
</td>
@endisset
</tr>
@endforeach
</tbody>
</table>
I am then using this from a different component like this
<x-components.table :columns="['Title', 'Status', 'Description']" :rows="$data">
<x-slot name="actions">
//here is where I want to add a custom action that needs to be able to access the $row data
</x-slot>
</x-components.table>
I tried adding the below as I thought using the x-slot would give it access to the scope of the foreach($rows as $row)
, but I just get an undefined variable error.
<a x-on:click="console.log()>Test</a>
So how do I go about being able to add custom actions that have access to the row data that they're for?
source https://stackoverflow.com/questions/77366576/how-do-i-add-custom-actions-in-a-blade-table
No comments:
Post a Comment