web/views/tableview.py
branchstable
changeset 5617 f0bc8f5ddee2
parent 5529 7446f5807b33
child 5619 a2c9a55b5a9d
equal deleted inserted replaced
5616:859225caf375 5617:f0bc8f5ddee2
   116                 displaycols = range(len(self.cw_rset.syntax_tree().children[0].selection))
   116                 displaycols = range(len(self.cw_rset.syntax_tree().children[0].selection))
   117         return displaycols
   117         return displaycols
   118 
   118 
   119     def call(self, title=None, subvid=None, displayfilter=None, headers=None,
   119     def call(self, title=None, subvid=None, displayfilter=None, headers=None,
   120              displaycols=None, displayactions=None, actions=(), divid=None,
   120              displaycols=None, displayactions=None, actions=(), divid=None,
   121              cellvids=None, cellattrs=None, mainindex=None):
   121              cellvids=None, cellattrs=None, mainindex=None,
       
   122              paginate=False, page_size=None):
   122         """Produces a table displaying a composite query
   123         """Produces a table displaying a composite query
   123 
   124 
   124         :param title: title added before table
   125         :param title: title added before table
   125         :param subvid: cell view
   126         :param subvid: cell view
   126         :param displayfilter: filter that selects rows to display
   127         :param displayfilter: filter that selects rows to display
   176             self.w(u'>') # close <div tag
   177             self.w(u'>') # close <div tag
   177         # render actions menu
   178         # render actions menu
   178         if actions:
   179         if actions:
   179             self.render_actions(divid, actions)
   180             self.render_actions(divid, actions)
   180         # render table
   181         # render table
       
   182         if paginate:
       
   183             self.divid = divid # XXX iirk (see usage in page_navigation_url)
       
   184             self.paginate(page_size=page_size, show_all_option=False)
   181         table = TableWidget(self)
   185         table = TableWidget(self)
   182         for column in self.get_columns(computed_labels, displaycols, headers,
   186         for column in self.get_columns(computed_labels, displaycols, headers,
   183                                        subvid, cellvids, cellattrs, mainindex):
   187                                        subvid, cellvids, cellattrs, mainindex):
   184             table.append_column(column)
   188             table.append_column(column)
   185         table.render(self.w)
   189         table.render(self.w)
   186         self.w(u'</div>\n')
   190         self.w(u'</div>\n')
   187         if not fromformfilter:
   191         if not fromformfilter:
   188             self.w(u'</div>\n')
   192             self.w(u'</div>\n')
       
   193 
       
   194     def page_navigation_url(self, navcomp, path, params):
       
   195         rql = params.pop('rql', self.cw_rset.printable_rql())
       
   196         # latest 'true' used for 'swap' mode
       
   197         return 'javascript: replacePageChunk(%s, %s, %s, %s, true)' % (
       
   198             dumps(self.divid), dumps(rql),
       
   199             dumps(self.__regid__), dumps(params))
   189 
   200 
   190     def show_hide_actions(self, divid, currentlydisplayed=False):
   201     def show_hide_actions(self, divid, currentlydisplayed=False):
   191         showhide = u';'.join(toggle_action('%s%s' % (divid, what))[11:]
   202         showhide = u';'.join(toggle_action('%s%s' % (divid, what))[11:]
   192                              for what in ('Form', 'Show', 'Hide', 'Actions'))
   203                              for what in ('Form', 'Show', 'Hide', 'Actions'))
   193         showhide = 'javascript:' + showhide
   204         showhide = 'javascript:' + showhide