allow divid as argument
authorsylvain.thenault@logilab.fr
Mon, 26 Jan 2009 11:06:17 +0100
changeset 469 365826a58664
parent 468 3fac8c508779
child 470 5d4a9db36738
allow divid as argument
web/views/tableview.py
--- a/web/views/tableview.py	Mon Jan 26 11:05:49 2009 +0100
+++ b/web/views/tableview.py	Mon Jan 26 11:06:17 2009 +0100
@@ -72,7 +72,7 @@
         return displaycols
     
     def call(self, title=None, subvid=None, displayfilter=None, headers=None,
-             displaycols=None, displayactions=None, actions=(),
+             displaycols=None, displayactions=None, actions=(), divid=None,
              cellvids=None, cellattrs=None):
         """Dumps a table displaying a composite query
 
@@ -93,7 +93,7 @@
         hidden = True
         if not subvid and 'subvid' in req.form:
             subvid = req.form.pop('subvid')
-        divid = req.form.get('divid') or 'rs%s' % make_uid(id(rset))
+        divid = divid or req.form.get('divid') or 'rs%s' % make_uid(id(rset))
         actions = list(actions)
         if mainindex is None:
             displayfilter, displayactions = False, False
@@ -208,7 +208,6 @@
             else:
                 column.append_renderer(subvid or 'incontext', colindex)
 
-
             if cellattrs and colindex in cellattrs:
                 for name, value in cellattrs[colindex].iteritems():
                     column.add_attr(name,value)
@@ -291,7 +290,7 @@
     # parameters
     title = None
     
-    def call(self, title=None, subvid=None, headers=None,
+    def call(self, title=None, subvid=None, headers=None, divid=None,
              displaycols=None, displayactions=None):
         """Dumps a table displaying a composite query"""
         actrql = self.req.form['actualrql']
@@ -299,6 +298,8 @@
         displaycols = self.displaycols(displaycols)
         if displayactions is None and 'displayactions' in self.req.form:
             displayactions = True
+        if divid is None and 'divid' in self.req.form:
+            divid = self.req.form['divid']
         self.w(u'<div class="section">')
         if not title and 'title' in self.req.form:
             # pop title so it's not displayed by the table view as well
@@ -317,7 +318,6 @@
                                                           filtered_variable=mainvar))
                 
                 if facets:
-                    divid = self.req.form.get('divid', 'filteredTable')
                     self.generate_form(divid, baserql, facets, 
                                        vidargs={'displaycols': displaycols,
                                                 'displayactions': displayactions,
@@ -329,7 +329,7 @@
         self.view('table', self.req.execute(actrql),
                   'noresult', w=self.w, displayfilter=False, subvid=subvid,
                   displayactions=displayactions, displaycols=displaycols,
-                  actions=actions, headers=headers)
+                  actions=actions, headers=headers, divid=divid)
         self.w(u'</div>\n')