MishkaGervaz.Table.Types.Action.Edit (MishkaGervaz v0.0.1-alpha.2)

Copy Markdown View Source

Edit action type - renders a button that sends the record to the form component.

Dispatches a row_action event with the action name and record ID, which is intercepted by the table events handler to send directly to the form component via send_update.

Usage

row_actions do
  action :edit, type: :edit
  action :edit, type: :edit, js: fn _record -> JS.exec("data-show-modal", to: "#form-modal") end
end

JS Hook

When js is set, the user's JS commands run first, then the push event is chained:

action :edit, type: :edit, js: fn _record ->
  JS.exec("data-show-modal", to: "#form-modal")
end

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