Updated refresh events
authorThierry Florac <tflorac@ulthar.net>
Sun, 26 Nov 2017 09:55:24 +0100
changeset 288 3f7f7a1624f0
parent 287 834b484129fd
child 289 5ab6ce5c00fb
Updated refresh events
src/pyams_content/shared/common/zmi/types.py
--- a/src/pyams_content/shared/common/zmi/types.py	Sun Nov 26 09:55:00 2017 +0100
+++ b/src/pyams_content/shared/common/zmi/types.py	Sun Nov 26 09:55:24 2017 +0100
@@ -521,16 +521,18 @@
     def get_ajax_output(self, changes):
         subtypes_table = DatatypeSubtypesTable(self.context, self.request)
         subtypes_table.update()
-        return {'status': 'success',
-                'message': self.request.localizer.translate(_("Subtype was correctly added.")),
-                'events': [{
-                    'event': 'PyAMS_content.changed_item',
-                    'options': {
-                        'handler': 'PyAMS_content.types.refreshSubtypes',
-                        'object_name': subtypes_table.id,
-                        'table': subtypes_table.render()
-                    }
-                }]}
+        return {
+            'status': 'success',
+            'message': self.request.localizer.translate(_("Subtype was correctly added.")),
+            'events': [{
+                'event': 'myams.refresh',
+                'options': {
+                    'handler': 'MyAMS.skin.refreshTable',
+                    'object_id': subtypes_table.id,
+                    'table': subtypes_table.render()
+                }
+            }]
+        }
 
 
 @pagelet_config(name='properties.html', context=ISubType, layer=IPyAMSLayer, permission=MANAGE_TOOL_PERMISSION)
@@ -563,15 +565,17 @@
             target = get_parent(self.context, IDataType)
             subtypes_table = DatatypeSubtypesTable(target, self.request)
             subtypes_table.update()
-            return {'status': 'success',
-                    'message': self.request.localizer.translate(self.successMessage),
-                    'events': [{
-                        'event': 'PyAMS_content.changed_item',
-                        'options': {
-                            'handler': 'PyAMS_content.types.refreshSubtypes',
-                            'object_name': subtypes_table.id,
-                            'table': subtypes_table.render()
-                        }
-                    }]}
+            return {
+                'status': 'success',
+                'message': self.request.localizer.translate(self.successMessage),
+                'events': [{
+                    'event': 'myams.refresh',
+                    'options': {
+                        'handler': 'MyAMS.skin.refreshTable',
+                        'object_id': subtypes_table.id,
+                        'table': subtypes_table.render()
+                    }
+                }]
+            }
         else:
             return super(DataSubtypeAJAXEditForm, self).get_ajax_output(changes)