Action Definitions
Actions are operations that can be performed on table data There are 3 types of actions: bulk actions, table actions, and row actions.
- Bulk Actions: Actions that can be performed on multiple selected rows. Selected rows are passed to the action callback, allowing for operations on multiple items at once.
- Table Actions: Actions that can be performed on the table as a whole. It doesn't have an access to the row data, so it's typically used for operations that affect the entire table, e.g. cleaning the table data.
- Row Actions: Actions that can be performed on individual rows. These actions are acce
Each action callback returns an ActionHandlerResult object, below you can see its definition:
ActionHandlerResult
Bases: TypedDict
Represents the result of an action handler.
| ATTRIBUTE | DESCRIPTION |
|---|---|
success |
Indicates whether the action was successful.
TYPE:
|
error |
(Optional) Error message if the action failed.
TYPE:
|
redirect |
(Optional) URL to redirect to after the action.
TYPE:
|
message |
(Optional) Informational message about the action result.
TYPE:
|
Source code in ckanext/tables/types.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
BulkActionDefinition
dataclass
Defines an action that can be performed on multiple rows.
| ATTRIBUTE | DESCRIPTION |
|---|---|
action |
Unique identifier for the action.
TYPE:
|
label |
Display label for the action.
TYPE:
|
callback |
Function to be called when the action is triggered.
TYPE:
|
icon |
(Optional) Icon class for the action.
TYPE:
|
Source code in ckanext/tables/table.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
TableActionDefinition
dataclass
Defines an action that can be performed on the table itself.
| ATTRIBUTE | DESCRIPTION |
|---|---|
action |
Unique identifier for the action.
TYPE:
|
label |
Display label for the action.
TYPE:
|
callback |
Function to be called when the action is triggered.
TYPE:
|
icon |
(Optional) Icon class for the action.
TYPE:
|
Source code in ckanext/tables/table.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
RowActionDefinition
dataclass
Defines an action that can be performed on a row.
| ATTRIBUTE | DESCRIPTION |
|---|---|
action |
Unique identifier for the action.
TYPE:
|
label |
Display label for the action.
TYPE:
|
callback |
Function to be called when the action is triggered.
TYPE:
|
icon |
(Optional) Icon class for the action.
TYPE:
|
with_confirmation |
(Optional) Whether to show a confirmation dialog before executing the action.
TYPE:
|
Source code in ckanext/tables/table.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |