merge
authorSandrine Ribeau <sandrine.ribeau@logilab.fr>
Mon, 08 Dec 2008 17:33:58 -0800
changeset 193 cd9cc0153835
parent 192 46b24614282c (current diff)
parent 187 cae87ca76f02 (diff)
child 194 8280fa6906f3
child 197 1632e01a58a9
merge
--- a/web/views/treeview.py	Mon Dec 08 17:33:11 2008 -0800
+++ b/web/views/treeview.py	Mon Dec 08 17:33:58 2008 -0800
@@ -22,8 +22,14 @@
         css_classes = 'treeview widget'
         if self.fstree:
             css_classes += ' filetree'
-        self.w(u'<ul class="%s" cubicweb:loadtype="auto" cubicweb:wdgtype="TreeView">'
-               % css_classes)
+        # XXX noautoload is a quick hack to avoid treeview to be rebuilt
+        #     after a json query and avoid double toggling bugs.
+        #     Need to find a way to do that cleanly.
+        if 'noautoload' in self.req.form:
+            self.w(u'<ul class="%s" cubicweb:wdgtype="TreeView">' % css_classes)
+        else:
+            self.w(u'<ul class="%s" cubicweb:loadtype="auto" cubicweb:wdgtype="TreeView">'
+                   % css_classes)
         for rowidx in xrange(len(self.rset)):
             self.wview(self.itemvid, self.rset, row=rowidx, col=0,
                        vid=subvid, parentvid=self.id)
@@ -97,7 +103,8 @@
             rql = entity.children_rql() % {'x': entity.eid}
             url = html_escape(self.build_url('json', rql=rql, vid=parentvid,
                                              pageid=self.req.pageid,
-                                             subvid=vid))
+                                             subvid=vid,
+                                             noautoload=True))
             cssclasses.append('expandable')
             divclasses = ['hitarea expandable-hitarea']
             if is_leaf :