Row actions overview

Defining per-row actions with TableRowAction

Row actions are buttons on each row — View, Edit, Archive, Toggle active, etc. You define them in PHP; the frontend renders buttons from the rowActions object in structure JSON.

When to use row vs bulk actions

Row actionBulk action
Affects one recordAffects selection or full filtered set
Archive one orderExport 50 selected orders
View detailsEmail report of all filtered rows

Anatomy of a row action

use Storageitsolutions\ApisTables\Actions\RowActions\TableRowAction;
use Storageitsolutions\ApisTables\Enums\RowActionsTypes;
use Storageitsolutions\ApisTables\Enums\ActionOnSuccessDo;

protected function setRowActions(): array
{
    return array_merge(parent::setRowActions(), [
        'archive' => new TableRowAction(
            tableName: self::TABLENAME,
            key: 'archive',
            label: 'Archive',
            action_type: RowActionsTypes::ROW_ACT_TYPE_NORMAL,
            executeCallBack: 'archiveRecord',
            isApplicableCallback: 'canArchive',
            need_confirmation: true,
        ),
    ]);
}
ParameterPurpose
keyURL segment — slugified to archive
labelButton text in UI
action_typeHow frontend behaves — Action types
executeCallBackMethod name on your table class
isApplicableCallbackHide button when returns false
need_confirmationShow confirm dialog before POST

Implement the callback

use Illuminate\Http\Request;

public function archiveRecord(int|string $id, Request $request): array
{
  $order = $this->model::findOrFail($id);
  $this->authorize('archive', $order); // optional policy

  $order->update(['status' => 'archived']);

  return [
    'success' => true,
    'message' => 'Order archived',
  ];
}

Return shape should include success: true or success: false with errors array.

Built-in: show_details

Every table inherits show_details unless you replace setRowActions() entirely without merging parent. It calls getRowDetails and opens a modal (onSuccess: DisplayOnModal).

onSuccess — what frontend does after

ActionOnSuccessDoFrontend behavior
refetchRowRefresh single row (row-refetch)
refetchDataReload full table (query-table)
DisplayOnModalShow response data in modal
no_actionNo automatic refresh

Set on the action object:

$action = new TableRowAction(/* ... */);
$action->setOnSuccess(ActionOnSuccessDo::ROWACTION_SUCCESS_DATAFETCH);

Conditional visibility

public function canArchive($item): bool
{
    return $item->status !== 'archived';
}

Pass 'canArchive' as isApplicableCallback. Returning false removes the button for that row only.

Row bulk (multi-select same action)

Enable running a row action on multiple selected IDs:

$action->setApplicableAsBulk(true);

Client calls row-bulk-table-action/{table}/{action} with selected_ids: [1,2,3].

Common mistakes

MistakeResult
Forgot to merge parent actionsLose show_details
Callback method typo500 or action not defined
Key mismatch in URLAction is not defined
No success in returnFrontend error handling breaks

On this page