fix: use getWidgetById instead of this in tree script

This commit is contained in:
p 2026-08-12 17:00:04 +08:00
parent 61fb3f6485
commit ebf7757dd2

View File

@ -61,7 +61,7 @@ async with DBPools().sqlorContext(dbname) as sor:
"event": "selected",
"actiontype": "script",
"target": "self",
"script": f"var nid=this.selected_node.user_data.id;var fp=bricks.getWidgetById('ws_files',bricks.app);if(fp)fetch('{files_url}?id='+encodeURIComponent(nid)).then(function(r){{return r.json()}}).then(function(d){{fp.dom_element.innerHTML='';bricks.widgetBuild(d,fp);}});"
"script": f"var tree=bricks.getWidgetById('ws_tree',bricks.app);var nid=tree.selected_node.user_data.id;var fp=bricks.getWidgetById('ws_files',bricks.app);if(fp)fetch('{files_url}?id='+encodeURIComponent(nid)).then(function(r){{return r.json()}}).then(function(d){{fp.dom_element.innerHTML='';bricks.widgetBuild(d,fp);}});"
}]
}]
},