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
18 19 20 21 22 23 24 25 26 27 28 29 30 | |
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
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
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
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
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
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |