From 4db32670e9e87853dc0de02d2bca3664465a8617 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 30 Jul 2026 11:20:19 +0800 Subject: [PATCH] fix: getWidgetById from bricks.app root, clear_widgets+widgetBuild for nav getWidgetById searches DOWNWARD (children), not upward. For ancestor sage_main_content, must search from bricks.app global root. Using clear_widgets()+widgetBuild instead of nonexistent set_url(). --- wwwroot/model_plaza.ui | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/wwwroot/model_plaza.ui b/wwwroot/model_plaza.ui index 8b7b2fc..2f73d6b 100644 --- a/wwwroot/model_plaza.ui +++ b/wwwroot/model_plaza.ui @@ -26,10 +26,8 @@ "clear_label": "清除" }, "binds": [{ - "wid": "self", "event": "search", "actiontype": "urlwidget", - "target": "sage_main_content", "mode": "replace", - "options": {"url": "{{base}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search=${keyword}"}, - "params_mapping": {"keyword": "keyword"} + "wid": "self", "event": "search", "actiontype": "script", "target": "self", + "script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:"{{base}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search='+encodeURIComponent((event.params&&event.params.keyword)||event.keyword||'')}},t);}" }] } ] @@ -46,9 +44,8 @@ "cwidth": 8, "cheight": 2 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "urlwidget", - "target": "sage_main_content", "mode": "replace", - "options": {"url": "{{base}}?providerid={{active_provider}}&search={{active_search}}"} + "wid": "self", "event": "click", "actiontype": "script", "target": "self", + "script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?providerid={{active_provider}}&search={{active_search}}'}},t);}" }] } {% for c in catelogs %} @@ -60,9 +57,8 @@ "cwidth": 10, "cheight": 2 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "urlwidget", - "target": "sage_main_content", "mode": "replace", - "options": {"url": "{{base}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}"} + "wid": "self", "event": "click", "actiontype": "script", "target": "self", + "script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}'}},t);}" }] } {% endfor %} @@ -96,9 +92,8 @@ "cwidth": 18 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "urlwidget", - "target": "sage_main_content", "mode": "replace", - "options": {"url": "{{base}}?catelogid={{active_catelog}}&search={{active_search}}"} + "wid": "self", "event": "click", "actiontype": "script", "target": "self", + "script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?catelogid={{active_catelog}}&search={{active_search}}'}},t);}" }] } {% for p in providers %} @@ -110,9 +105,8 @@ "cwidth": 18 }, "binds": [{ - "wid": "self", "event": "click", "actiontype": "urlwidget", - "target": "sage_main_content", "mode": "replace", - "options": {"url": "{{base}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}"} + "wid": "self", "event": "click", "actiontype": "script", "target": "self", + "script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}'}},t);}" }] } {% endfor %}