workspace: bind on PopupWindow level, wid=ws_tree

This commit is contained in:
p 2026-08-12 17:30:37 +08:00
parent 888e1ff320
commit fdecd9ee1f

View File

@ -55,14 +55,7 @@ async with DBPools().sqlorContext(dbname) as sor:
"css": "filler",
"padding": "4px",
"cheight": "100%"
},
"binds": [{
"wid": "self",
"event": "selected",
"actiontype": "script",
"target": "self",
"script": f"console.log('BIND FIRED');var tree=bricks.getWidgetById('ws_tree',bricks.app);if(!tree){{console.log('no tree');return;}}var nid=tree.selected_node.user_data.id;console.log('nid='+nid);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){{console.log('loaded type='+d.widgettype);fp.dom_element.innerHTML='';bricks.widgetBuild(d,fp);console.log('ws_files innerHTML='+fp.dom_element.innerHTML.length);}});}}else{{console.log('no fp');}}"
}]
}
}]
},
{
@ -76,6 +69,13 @@ async with DBPools().sqlorContext(dbname) as sor:
}
}
]
}],
"binds": [{
"wid": "ws_tree",
"event": "selected",
"actiontype": "script",
"target": "self",
"script": f"console.log('BIND FIRED');var tree=bricks.getWidgetById('ws_tree',bricks.app);if(!tree){{console.log('no tree');return;}}var nid=tree.selected_node.user_data.id;console.log('nid='+nid);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){{console.log('loaded type='+d.widgettype);fp.dom_element.innerHTML='';bricks.widgetBuild(d,fp);console.log('ws_files innerHTML='+fp.dom_element.innerHTML.length);}});}}else{{console.log('no fp');}}"
}]
}