Columns¶
You'll find below all the available methods to interact with the columns of a SeaTable table.
Global structure¶
Here is the global structure of a column object:
{
"key":"bjcM",
"type":"number",
"name":"Val",
"editable":true,
"width":200,
"resizable":true,
"draggable":true,
"data": // (1)!
{
"format":"number",
"precision":2,
"enable_precision":false,
"enable_fill_default_value":false,
"enable_check_format":false,
"decimal":"comma",
"thousands":"no",
"format_min_value":0,
"format_max_value":1000
},
"permission_type":"",
"permitted_users":[],
"permitted_group":[],
"edit_metadata_permission_type":"",
"edit_metadata_permitted_users":[],
"edit_metadata_permitted_group":[],
"description":null,
"colorbys":{},
"editor":
{
"key":null,
"ref":null,
"props":{},
"_owner":null
},
"formatter":
{
"key":null,
"ref":null,
"props":{},
"_owner":null
}
}
- See below for a presentation of
dataobject keys depending on the columntype
Columns particularities
- Unless other elements, columns don't have an
_id, but akey - Link-type columns also have a link id that should not be mistaken with the column
key. This value is present in thedataobject (see below)
Column data¶
The data object keys will depend on the column type and will allow you to define the specific column parameters. Here is a list of the different data keys depending on the column type:
text, email, long-text, image, file, url, creator, ctime, last-modifier, mtime
empty
link
number
single select, multiple select
{
"options":
[
{
"name":"Male",
"id":"783482",
"color":"#46A1FD",
"textColor":"#FFFFFF",
"borderColor":"#3C8FE4"
},
{
"name":"Female",
"id":"330935",
"color":"#DC82D2",
"textColor":"#FFFFFF",
"borderColor":"#D166C5"
},
{
"name":"Non-binary",
"id":"147140",
"color":"#ADDF84",
"textColor":"#FFFFFF",
"borderColor":"#9CCF72"
}
],
"cascade_column_key":"Qvkt",
"cascade_settings":
{
"147140":["783482"],
"330935":["330935"],
"783482":["783482"]
}
}
rate
formula
link-formula
{
"formula":"findmax",
"result_type":"array",
"operated_columns":["TaXD"],
"conditions":[],
"link_column_key":"TaXD",
"include_condition":false,
"condition_conjunction":"And",
"column_key_in_linked_record":"0000",
"column_key_for_comparison":"RSjx",
"level2_linked_table_column_key":null,
"array_type":"auto-number",
"array_data":null
}
auto-number
button
Accessing a particular data object value
This rather long list is not exhaustive, however. If you need to access a specific data value, consult the SeaTable API Reference or create the corresponding column to display the content of its data object.
Get Column(s)¶
getColumnByName
Get the column object of a particular table, specified by the column name.
table: either a table object or the table name
Output Single column object (undefined if column name doesn't exist)
Example
getColumns
Get all the columns of a specific table.
table: either a table object or the table name
Output Array of column objects (throws an error if table doesn't exist)
Example
listColumns
Get the columns of a table (specified by its name tableName), optionally from a specific view (specified by its name viewName). If viewName is not set, all columns of the table will be returned (equivalent, in this case, to base.getColumns).
Output Array of column objects (throws an error if table doesn't exist)
Example
getShownColumns
Get all the columns of a table displayed in a specific view (hidden columns are not returned).
-
table: either a table object or the table nameview(required): either a view object or the view name
Output Array of column objects (throws an error if table or view doesn't exist)
Example
getColumnsByType
Get all the columns of a specific type in a table.
-
table: either a table object or the table nametype(required): the type of the column (see the API Reference for supported types)
Output Array of column objects (empty array if no corresponding columns or wrong type)
Example