For demo purposes it’s bound to an expression binding null
with a script transform to return the items dictionary object.
Binding dictionary object
true = True
false = False
return [
{
"label": "Building 1",
"expanded": false,
"data": "",
"items": [
{
"label": "Line #13",
"expanded": false,
"data": {
"location": "Building_1",
"equipment": "Line #13"
},
"items": []
},
{
"label": "Line #14",
"expanded": false,
"data": {
"location": "Building_1",
"equipment": "Line #14"
},
"items": []
},
{
"label": "Line #15",
"expanded": false,
"data": {
"location": "Building_1",
"equipment": "Line #15"
},
"items": []
},
{
"label": "Line #17",
"expanded": false,
"data": {
"location": "Building_1",
"equipment": "Line #17"
},
"items": []
},
{
"label": "Line #18",
"expanded": false,
"data": {
"location": "Building_1",
"equipment": "Line #18"
},
"items": []
}
]
},
{
"label": "Building_2",
"expanded": false,
"data": "",
"items": [
{
"label": "Line #23",
"expanded": false,
"data": {
"location": "Building_2",
"equipment": "Line #23"
},
"items": []
},
{
"label": "Line #24",
"expanded": false,
"data": {
"location": "Building_2",
"equipment": "Line #24"
},
"items": []
},
{
"label": "Line #25",
"expanded": false,
"data": {
"location": "Building_2",
"equipment": "Line #25"
},
"items": []
},
{
"label": "Line #27",
"expanded": false,
"data": {
"location": "Building_2",
"equipment": "Line #27"
},
"items": []
},
{
"label": "Line #28",
"expanded": false,
"data": {
"location": "Building_2",
"equipment": "Line #28"
},
"items": []
}
]
}
]
'''
So the binding data never changes.
If you’d like to test it then create a coordinate view and drop these two items into it.
Tree
[
{
"type": "ia.display.tree",
"version": 0,
"props": {
"selection": [
"1/2"
],
"selectionData": [
{
"itemPath": "1/2",
"value": {
"equipment": "Line #25",
"location": "Building_2"
}
}
],
"appearance": {
"expandIcons": {
"collapsed": {
"path": "material/arrow_right"
},
"expanded": {
"path": "material/arrow_drop_down"
}
},
"defaultNodeIcons": {
"expanded": {
"path": "material/folder_open"
},
"collapsed": {
"path": "material/folder"
},
"empty": {
"path": "material/stop"
}
}
},
"style": {
"borderStyle": "solid",
"borderWidth": 1,
"borderColor": "#81F68A"
}
},
"meta": {
"name": "Tree"
},
"position": {
"x": 60,
"y": 136,
"height": 200,
"width": 305
},
"custom": {},
"propConfig": {
"props.items": {
"binding": {
"type": "expr",
"config": {
"expression": "null"
},
"transforms": [
{
"code": "\ttrue = True\n\tfalse = False\n\t\n\treturn [\n\t {\n\t \"label\": \"Building 1\",\n\t \"expanded\": false,\n\t \"data\": \"\",\n\t \"items\": [\n\t {\n\t \"label\": \"Line #13\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_1\",\n\t \"equipment\": \"Line #13\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #14\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_1\",\n\t \"equipment\": \"Line #14\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #15\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_1\",\n\t \"equipment\": \"Line #15\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #17\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_1\",\n\t \"equipment\": \"Line #17\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #18\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_1\",\n\t \"equipment\": \"Line #18\"\n\t },\n\t \"items\": []\n\t }\n\t ]\n\t },\n\t \t {\n\t \"label\": \"Building_2\",\n\t \"expanded\": false,\n\t \"data\": \"\",\n\t \"items\": [\n\t {\n\t \"label\": \"Line #23\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_2\",\n\t \"equipment\": \"Line #23\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #24\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_2\",\n\t \"equipment\": \"Line #24\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #25\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_2\",\n\t \"equipment\": \"Line #25\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #27\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_2\",\n\t \"equipment\": \"Line #27\"\n\t },\n\t \"items\": []\n\t },\n\t {\n\t \"label\": \"Line #28\",\n\t \"expanded\": false,\n\t \"data\": {\n\t \"location\": \"Building_2\",\n\t \"equipment\": \"Line #28\"\n\t },\n\t \"items\": []\n\t }\n\t ]\n\t }\n\t]",
"type": "script"
}
]
}
}
}
}
]
Button
[
{
"type": "ia.input.button",
"version": 0,
"props": {
"text": "Refresh"
},
"meta": {
"name": "Button"
},
"position": {
"x": 285,
"y": 346,
"height": 34,
"width": 80
},
"custom": {},
"events": {
"dom": {
"onClick": {
"type": "script",
"scope": "G",
"config": {
"script": "\tself.getSibling(\"Tree\").refreshBinding(\"props.items\")\n\tx = int(self.getSibling(\"Tree\").props.selection[0].split('/')[0])\n\tself.getSibling(\"Tree\").props.items[x].expanded = True"
}
}
}
}
}
]