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().
This commit is contained in:
parent
8d8f9b58a5
commit
4db32670e9
@ -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 %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user