web/views/tableview.py
changeset 8055 368d8902e597
parent 8046 bdd555df7a91
child 8058 a536053b0588
--- a/web/views/tableview.py	Fri Nov 04 13:03:35 2011 +0100
+++ b/web/views/tableview.py	Fri Nov 04 13:03:52 2011 +0100
@@ -292,16 +292,18 @@
         showhide = u';'.join(toggle_action('%s%s' % (divid, what))[11:]
                              for what in ('Form', 'Show', 'Hide', 'Actions'))
         showhide = 'javascript:' + showhide
+        self._cw.add_onload(u'''\
+$(document).ready(function() {
+  if ($('#%(id)sForm[class=\"hidden\"]').length) {
+    $('#%(id)sHide').attr('class', 'hidden');
+  } else {
+    $('#%(id)sShow').attr('class', 'hidden');
+  }
+});''' % {'id': divid})
         showlabel = self._cw._('show filter form')
         hidelabel = self._cw._('hide filter form')
-        if currentlydisplayed:
-            c1, d1 = 'hidden', '%sShow' % divid
-            c2, d2 = None, '%sHide' % divid
-        else:
-            c1, d1 = None, '%sShow' % divid
-            c2, d2 = 'hidden', '%sHide' % divid
-        return [component.Link(showhide, showlabel, klass=c1, id=d1),
-                component.Link(showhide, hidelabel, klass=c2, id=d2)]
+        return [component.Link(showhide, showlabel, id='%sShow' % divid),
+                component.Link(showhide, hidelabel, id='%sHide' % divid)]
 
 
 class AbstractColumnRenderer(object):