Hierarchical selection¶
Insight supports hierarchical selections out of the box that are needed in many usecases. Hierarchical selections here mean having one attribute with a selectFromTree
that then filters the next attribute with a selectFromTree
that then filters the next attribute, and so on. This behaviour can be reproduced as well with custom attributeControls
but it is much easier to use the hierarchySelection configuration. To use a hierarchical selection, use the following notation:
{
"name": "my-example-node",
"label": "${myLabelAttribute}",
"icon": "icon-site-map",
"attributes": [
{
"name": "a",
"selectFromTree": {
"tree": "sft-a",
"node": "myNode",
"attribute": "a",
"autofill": [
{
"src": "a2",
"dst": "a2"
}
]
}
},
{
"name": "a2"
},
{
"name": "b",
"selectFromTree": {
"tree": "sft-b",
"node": "myNode",
"attribute": "b",
"filter": {
"PARENT": "${a2}"
}
}
},
{
"name": "c",
"selectFromTree": {
"tree": "sft-c",
"node": "myNode",
"attribute": "c",
"filter": {
"PARENT": "${b}"
},
"autofill": [
{
"src": "c2",
"dst": "c2"
},
{
"src": "c3",
"dst": "c3"
}
]
}
},
{
"name": "c2"
},
{
"name": "c3"
},
{
"name": "d",
"selectFromTree": {
"tree": "sft-d",
"node": "myNode",
"attribute": "d",
"filter": {
"PARENT": "${c2}"
}
}
}
],
"hierarchySelections": [
{
"levels": [
{
"mainAttribute": "a",
"clearAttributes": ["a2"]
},
{
"mainAttribute": "b"
},
{
"mainAttribute": "c",
"clearAttributes": ["c2", "c3"]
},
{
"mainAttribute": "d"
}
]
}
]
}
Each hierarchySelection can have as many levels as you want. Each level consists of two parts: The mainAttribute
, and the clearAttributes
, which are optional. Both just reference the regular Insight attributes from the same node.
To support a smooth workflow, the hierarchySelection has a few features:
- If you select a value in one level's
mainAttribute
, it automatically loads, filters and opens the next level'smainAttribute
- If there are no resulting records for the next level, it will not be opened automatically
- If you change a level's
mainAttribute
value within the level hierarchy chain, all subsequent level's values are cleared, as well as their additional attributes - All levels that do not have a value yet and are not the first unanswered level are readonly