Skip to content

Actions Column

PHP Setup

Use ActionsColumn to define where the actions column appears:

php
use Forjed\InertiaTable\Columns\ActionsColumn;

protected function columns(): array
{
    return [
        LinkColumn::make('name', 'Name')->route('servers.show', ['server' => ':id'])->sortable(),
        EnumColumn::make('status', 'Status')->sortable(),
        ActionsColumn::make(),       // actions render here
        Column::data('id'),          // hidden data available in actions
        Column::data('can_delete', fn ($m) => $m->canBeDeleted()),
    ];
}

If you don't add ActionsColumn to your PHP columns but pass an actions prop on the frontend, the actions column is auto-appended at the end.

Frontend Rendering

tsx
<InertiaTable
    tableData={servers}
    actions={(row) => (
        <div className="flex gap-2">
            <button onClick={() => editServer(row)}>Edit</button>
            {row.can_delete && (
                <button onClick={() => deleteServer(row.id)}>Delete</button>
            )}
        </div>
    )}
/>
vue
<!-- Coming soon -->

The actions function receives the full row data, including hidden Column::data() fields like id and can_delete.