src/pyams_content/component/association/zmi/__init__.py
changeset 873 5f40601f9cb0
parent 678 259e16f7189d
child 956 a8723fffbaf6
--- a/src/pyams_content/component/association/zmi/__init__.py	Fri Jul 20 01:02:27 2018 +0200
+++ b/src/pyams_content/component/association/zmi/__init__.py	Fri Jul 20 12:39:19 2018 +0200
@@ -124,11 +124,18 @@
         attributes.setdefault('table', {}).update({
             'data-ams-location': absolute_url(container, self.request),
             'data-ams-tablednd-drag-handle': 'td.sorter',
-            'data-ams-tablednd-drop-target': 'set-associations-order.json',
-            'data-ams-visibility-switcher': 'switch-association-visibility.json'
+            'data-ams-tablednd-drop-target': 'set-associations-order.json'
+        })
+        attributes.setdefault('td', {}).update({
+            'data-ams-attribute-switcher': self.get_switcher_target
         })
         return attributes
 
+    @staticmethod
+    def get_switcher_target(element, column):
+        if column.__name__ == 'show-hide':
+            return 'switch-association-visibility.json'
+
     @reify
     def values(self):
         return list(super(AssociationsTable, self).values)