Column configuration can be added for individual column in a view. It is accessed in View Settings by clicking the button and then the button next to the column name. Each column has View config and Default config. You can use the Default config to change the configuration for this column in all views and workspaces. The View config only applies to this column in the current view. The View config overrides the Default config.
The default config is saved in data_element_ref_columns.config
in database.
visible
(boolean) trueControls the visibility of a column in the grid. The column will still be used in the query and will be available for use in other columns for lookup purposes. It can be useful to have such an invisible column present, if the value of that column is needed for some reason (for example to use in condition cond
). Use the button to toggle.
Note: This removes the column from the grid entirely and the user can not make the column visible through the grid menu. If that is what is needed, it can be configured via "format"."agGridColumnProperties"."hide": true
.
excluded
(boolean) falseUse this to exclude column from grid and query. When true
, the column will not be included in the query and therefore not included in the grid or elsewhere. Use the button to toggle.
pinned
(boolean) falseThe pinned
setting specifies whether or not the column can be excluded (see above) by the user in simple plan view settings mode. Use the button to toggle.
edit
(object)The edit
settings controls whether or not a column is editable. To enable editing using default value it is enough to set edit
to true
. The editing can be customized by using edit
object properties:
{
"edit": {
"enabled": true
}
}
enabled
(boolean) false: Use to enable editing.checkboxes
(object): Display checkbox in column cell. More here.clientColumnChanged
: The actual client side column that was edited. Note that this may have been overridden by specifying targetColumn
in the configuration.cond
: (object). A condition that must be met so that editing is possible. This condition object will override view config condition if defined. More here.lookup
(boolean) false: Set to true
to use a dropdown with other values See more.lookupConfig
(object): The configuration of the lookup:
query
(object): The de-query to get the dropdown value and columnsidColumn
(string): The name of the column containing the id value in the queryvalueColumn
(string): The name of the column containing the caption value in the queryfixedOptions
(array): List of available options. See more.fixedOptionsAtStart
(array): List of available options at top of dropdown. See more below.translateOptions
(boolean) false: Set to true
to translate the available options.oldValue
: The previous value of the edited cell.targetColumn
(string): Specify a different column that will receive the changed value in the backend. By default this is set to current column but this can be overridden here.targetIdColumn
(string): The name of the column that should have get the value selected by the user. By default, if not specified this is the current column but this can be overridden here.type
: Set a new type for the column.action
(string) “update_value”: The action that will be executed after value has been changed in grid. The default action is update_value
which should be able to handle most updates. More here.actionArgs
(object): Action parameters. More here.The following arguments are sent to the update action when a cell is changed:
{
"newValue": 123,
"oldValue": 456,
"targetIdColumn": "theIdColumn",
"targetColumn": "someCol",
"clientColumnChanged": "someOtherCol"
}
newValue
: The new value of the edited cell.oldValue
: The previous value of the edited cell.targetIdColumn
: The id column that was changed (only present if a lookup value was changed, newValue and oldValue are values of the id column).targetColumn
: The column being changed (only used id targetIdColumn is not present).clientColumnChanged
: The actual client side column that was edited. Note that this may have been overridden by specifying targetColumn in the configuration.To specify that values should be presented in a dropdown the lookup
setting should be used. To use default values for a lookup it should be enough to set "lookup": true
. To configure the dropdown use the lookupConfig
object:
{
"edit": {
"enabled": true,
"lookup": true,
"lookupConfig": {
"query": {
"columns": [
{"name":"name_of_id_column"}
]
},
"idColumn": "name_of_id_column",
"valueColumn": "name_of_value_column"
},
"targetIdColumn": "name_of_id_column_to_be_set"
}
}
The de-query specified by lookupConfig.query
can refer to values in the row. This is useful if the values in a lookup depend on some other values. The syntax for this is that instead of values
being an array, it should be an object with the keys type
and name
. type
should be set to "fromRow"
and name
should be set to the name of the column in the row to take the value from. Example of this might be:
{
"edit": {
"enabled": true,
"lookup": true,
"lookupConfig": {
"query": {
"columns": [
{"name":"name_of_id_column"}
],
"filters": [
{
"column": {"name": "division_id"},
"operator": "=",
"values": {
"type": "fromRow",
"name": "selected_division_id"
}
}
]
},
}
}
}
Fixed options can be set using the lookupConfig.fixedOptions
property. Each option must contain id
and value
properties (see example below). By default all fixed options will be added after any options obtained by query. To change this, uselookupConfig.fixedOptionsAtStart
. Note however that if the currently selected option is not present (either from the query or from the fixed option list) then this currently selected option will be the very first one.
If using only fixed options the queryType
in the query
object must be set to "none"
.
{
"edit": {
"lookupConfig": {
"query": {
"queryType": "none"
},
"fixedOptions": [
{ "id": 997, "value": "Fix Opt 1" },
{ "id": 998, "value": "Fix Opt 2" },
{ "id": 999, "value": "Fix Opt 3" }
],
}
}
}
To translate the available options in your lookup, set translateOptions
to true.
{
"edit": {
"lookupConfig": {
"query": {
"queryType": "none"
},
"fixedOptions": [
{ "id": 997, "value": "FIX_OPTION_1" },
{ "id": 998, "value": "FIX_OPTION_2" },
{ "id": 999, "value": "FIX_OPTION_3" }
],
"translateOptions": true
}
}
}
format
(object)The format
configuration setting can be used to set details about the formatting of a column. Available settings are shown below:
{
"format": {
"caption": "A new caption",
"format": "number:2",
"align": "right",
"agGridColumnProperties": {
"width": 50,
"pinned": "left",
"someAgGridKey": "someValue"
}
}
}
caption
(string): The caption that the column should have. Note: The “caption” can (mostly for historical reasons) also be specified under “edit”. The caption value under “format” takes precedence (is used if specified).format
: (string): Overrides the format of the data serie. For more information, see Settings -> System -> Format Tester in the AGR app.align
(string) “left”: The column alignment. Supports “left” | “center” | “right”.agGridColumnProperties
: Allows explicitly setting AG Grid properties to the grid column. See documentation here. AG Grid properties are not tested and can easily introduce bugs. Some useful properties are:
width
(number): The initial width of the column. Note: The user can adjust this width, it is used initially and if the grid state is reset.pinned
(string): The pinned state of the column. Supported values are: “left” | “right”.hide
(boolean): Set to true
if the column should be hidden by default in grid. User can choose to make the column visible again via column menu).link
(object)The link
configuration setting specifies that values in the column should be HTML links that will, when clicked, open another view. The opened view will be drilled down to values specified in the row containing the clicked column.
{
"link": {
"targetView": "my_super_view",
"columns": [ "item_group_id_lvl_1" ],
"map": [
{
"from": "location",
"to": "location_2"
}
],
"drilldownsToClose": [ "col1", "col2" ],
"cond": {
"type": "=",
"column": "item_group_id_lvl_1",
"value": 65
},
"openNew": true,
"featureRef": "some-other-feature-ref",
"workspaceName": "some-other-workspace"
}
}
targetView
(string|number): The view that should be opened when link is clicked. When number is used, it will open view by it’s id. When string is used, it will open view by it’s config.view
property (see View Config). Settings here (in column row config))).columns
(array of strings) - Optional: List of column names that should have values set in the drilldown of the target view. The actual values will be copied from the row containing the clicked link. The column containing the link will be automatically added to the columns list.map
(object): Maps values from column in current view to column in target view. This is used when columns in different views are given it’s own ID for performance reasons. Then you can populate the target view drill-downs even though the columns are not the same.drilldownsToClose
(array of strings) - Optional: List of column names whoose drilldowns in the target view should be explicitly closed before the view is opened after clicking the link.cond
(object): A condition that must be met so that column value will be shown as link. If condition is not satisfied the value in the column will be shown normally (not as a link). More here.openNew
(boolean) false: When set to true, links will be opened in a new browser tab (using <a href="something" target="_blank">COLUMN VALUE</a>
)featureRef
(string): If specified along with workspaceName
, the target view is assumed to be in a different workspace and the link will have the browser moving to this new tab (in a new browser tab if openNew
is true, otherwise in the same tab).workspaceName
(string): See featureRef
above.row
(object)The row
config specifies how the content of the grid should be refreshed following the editing of a value. Row config can also be set for all columns at once in the view config. Settings here (in column row config) override the corresponding settings in the view config.
Note that the view config has additionally the settings uniqueKeyColumns
, applyUniqueKeyFiltersOnly
that can only be set at the view config level. These options can only be set at the view config level, since they can obviously not be overridden because of their nature (they apply to the whole view but not individual columns)
Also note that in order to use this configuration, in most cases you need to set the uniqueKeyColumns
setting in the view config. This is because refreshing a single row (or the whole grid) requires a row to have a unique key.
{
"row": {
"autoRefresh": true,
"refreshWholeGrid": false
}
}
autoRefresh
(boolean) false: Automatically refresh the grid row after cell edit.refreshWholeGrid
(boolean) false: Automatically refresh the whole grid after cell edit. Note that autoRefresh
must be true for this to take effect.aggregation
(object)This config has no effect when one or more series are present in the view. The type of aggregation, "sum"
or "avg"
can be specified like:
{
"aggregation": {
"type": "sum",
"enabled": true
}
}
Additionally editing can be enabled and a method of distributing an edited total can be specified:
{
"aggregation": {
"type": "sum",
"enabled": true,
"editable": true,
"distMethod": "proportional",
"action": "some_action"
}
}
type
(string) - Required: Supported aggregations are “sum” | “avg”:enabled
(boolean) false: Enables the aggregation.editable
(boolean) false: Enables editing of all values (values in rows and the value in the total row).distMethod
(string) Default depends on type: The method to used to distribute a value entered in the total row into the below row. Currently only one method is supported for each type but other methods may be implemented in the future.action
(string) “update_value”: The update action to execute when the value in the total row is updated. More here.actionArgs
(object): Action parameters. More here.The distMethod
s currently implemented for each type are:
"sum"
:
"proportional"
: The entered value is divided proportionally for all the current values."avg"
:
"simple"
: The entered value is set to all"proportional"
: The entered value is divided proportionally for all the current values.The following arguments are sent to the update action when the total cell is changed:
{
"newValue": 123,
"oldValue": 456,
"targetColumn": "someCol",
"clientColumnChanged": "someOtherCol",
"aggregationType": "avg",
"distMethod": "simple"
}
newValue
: The new value of the edited cell.oldValue
: The previous value of the edited cell.targetColumn
: The column being changed.clientColumnChanged
: The actual client side column that was edited. Note that this may have been overridden by specifying targetColumn
in the configuration.aggregationType
: The aggregation type configured on the column.distMethod
: The distribution method used to distribute the aggregation down to the cells.jsFormula
(string)This config sets the value of this column to a js formula, turning this column into a calculated column.
The formula is a conventional javascript expression but has the following built in functions:
pc(oldValue, newValue)
: Calculates a change in percentage from oldValue to newValuegetDateInt()
: Returns the current date as an integer: Year * 10000 + Month * 100 + DayOfMonthOther identifiers in the formula will be interpreted as columns in the current row.
See https://github.com/donmccurdy/expression-eval for details of the format.