Helper Functions
CKAN helper functions are typically used in templates, but also available everywhere with toolkit.h.helper_name().
tables_get_columns_visibility_from_request()
Get the column visibility settings from the request arguments.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, bool]
|
A dictionary mapping column field names to their visibility state (True/False). |
dict[str, bool]
|
Only hidden columns are included in the dictionary with False value. |
Source code in ckanext/tables/helpers.py
44 45 46 47 48 49 50 51 | |
tables_get_filters_from_request()
Get the filters from the request arguments.
| RETURNS | DESCRIPTION |
|---|---|
list[FilterItem]
|
A dictionary of filters |
Source code in ckanext/tables/helpers.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
tables_guess_data_source(resource, resource_view)
Guess the appropriate data source for a resource.
| PARAMETER | DESCRIPTION |
|---|---|
resource
|
The resource dictionary.
TYPE:
|
resource_view
|
Optional resource view dictionary. When it contains a
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BaseDataSource
|
An instantiated data source ready to use. |
Source code in ckanext/tables/helpers.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
tables_init_temporary_preview_table(resource, resource_view)
Initialize a temporary preview table for a given resource.
| PARAMETER | DESCRIPTION |
|---|---|
resource
|
The resource dictionary containing the URL and format of the data.
TYPE:
|
resource_view
|
Optional resource view dictionary. When it contains a
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TableDefinition
|
A TableDefinition object representing the initialized temporary preview table. |
Source code in ckanext/tables/helpers.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
tables_json_dumps(value)
Convert a value to a JSON string.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The value to convert to a JSON string
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The JSON string |
Source code in ckanext/tables/helpers.py
12 13 14 15 16 17 18 19 20 21 | |