MishkaGervaz.Table.Types.Action.Event (MishkaGervaz v0.0.1-alpha.3)

Copy Markdown View Source

Event action type - renders a button that triggers a LiveView event.

Used for custom actions that need to send events to the component/parent.

Usage

row_actions do
  action :approve, type: :event, event: "approve_record"
  action :archive, type: :event, confirm: "Are you sure?"
end

Payload

By default, sends %{id: record.id}. Use :payload for custom data:

action :process, type: :event, payload: fn record ->
  %{id: record.id, status: record.status}
end

See MishkaGervaz.Table.Types.Action (registry), MishkaGervaz.Table.Behaviours.ActionType, MishkaGervaz.Table.Entities.RowAction, and MishkaGervaz.Table.Entities.BulkAction.