Refresh renderer selection widget when renderer is changed
authorThierry Florac <thierry.florac@onf.fr>
Mon, 03 Sep 2018 16:29:39 +0200
changeset 916 7db52c3470d0
parent 915 ad76d21ab2a4
child 917 16ec26e3ed36
Refresh renderer selection widget when renderer is changed
src/pyams_content/component/paragraph/zmi/__init__.py
--- a/src/pyams_content/component/paragraph/zmi/__init__.py	Mon Sep 03 16:10:15 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/__init__.py	Mon Sep 03 16:29:39 2018 +0200
@@ -37,7 +37,7 @@
 from pyams_form.schema import ActionButton, CloseButton
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.event import get_json_switched_table_refresh_event
+from pyams_skin.event import get_json_switched_table_refresh_event, get_json_widget_refresh_event
 from pyams_skin.table import get_element_id
 from pyams_skin.viewlet.menu import MenuItem, MenuDivider
 from pyams_skin.viewlet.toolbar import ToolbarMenuItem
@@ -241,6 +241,11 @@
         if 'title' in changes.get(IBaseParagraph, ()):
             output.setdefault('events', []).append(
                 get_json_paragraph_refresh_event(self.context, self.request))
+        elif 'renderer' in self.widgets:
+            renderer_interface = self.widgets['renderer'].field.interface
+            if 'renderer' in changes.get(renderer_interface):
+                output.setdefault('events', []).append(
+                    get_json_widget_refresh_event(self.context, self.request, self.__class__, 'renderer'))
         return output