web/views/tableview.py
changeset 8006 32d7682991ce
parent 8003 7e240c04c69f
child 8007 dfbf0c43ee13
equal deleted inserted replaced
8005:a3e06bed6b18 8006:32d7682991ce
   137     display_actions = 'top' # None / 'top' / 'bottom'
   137     display_actions = 'top' # None / 'top' / 'bottom'
   138     hide_filter = True
   138     hide_filter = True
   139     add_view_actions = False
   139     add_view_actions = False
   140     header_column_idx = None
   140     header_column_idx = None
   141     enable_sorting = True
   141     enable_sorting = True
       
   142     sortvalue_limit = 10
   142     tablesorter_settings = {
   143     tablesorter_settings = {
   143         'textExtraction': JSString('cw.sortValueExtraction'),
   144         'textExtraction': JSString('cw.sortValueExtraction'),
   144         'selectorHeaders': "thead tr:first th", # only plug on the first row
   145         'selectorHeaders': "thead tr:first th", # only plug on the first row
   145         }
   146         }
   146 
   147 
   261     def cell_attributes(self, rownum, _colnum, renderer):
   262     def cell_attributes(self, rownum, _colnum, renderer):
   262         attrs = renderer.attributes.copy()
   263         attrs = renderer.attributes.copy()
   263         if renderer.sortable:
   264         if renderer.sortable:
   264             sortvalue = renderer.sortvalue(rownum)
   265             sortvalue = renderer.sortvalue(rownum)
   265             if isinstance(sortvalue, basestring):
   266             if isinstance(sortvalue, basestring):
   266                 sortvalue = sortvalue[:10]
   267                 sortvalue = sortvalue[:self.sortvalue_limit]
   267             if sortvalue is not None:
   268             if sortvalue is not None:
   268                 attrs[u'cubicweb:sortvalue'] = js_dumps(sortvalue)
   269                 attrs[u'cubicweb:sortvalue'] = js_dumps(sortvalue)
   269         return attrs
   270         return attrs
   270 
   271 
   271     def render_actions(self, w, actions):
   272     def render_actions(self, w, actions):