[tableview] sortvalue truncation should be somewhat configurable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 21 Oct 2011 18:37:30 +0200
changeset 8006 32d7682991ce
parent 8005 a3e06bed6b18
child 8007 dfbf0c43ee13
[tableview] sortvalue truncation should be somewhat configurable
web/views/tableview.py
--- a/web/views/tableview.py	Fri Oct 21 18:10:50 2011 +0200
+++ b/web/views/tableview.py	Fri Oct 21 18:37:30 2011 +0200
@@ -139,6 +139,7 @@
     add_view_actions = False
     header_column_idx = None
     enable_sorting = True
+    sortvalue_limit = 10
     tablesorter_settings = {
         'textExtraction': JSString('cw.sortValueExtraction'),
         'selectorHeaders': "thead tr:first th", # only plug on the first row
@@ -263,7 +264,7 @@
         if renderer.sortable:
             sortvalue = renderer.sortvalue(rownum)
             if isinstance(sortvalue, basestring):
-                sortvalue = sortvalue[:10]
+                sortvalue = sortvalue[:self.sortvalue_limit]
             if sortvalue is not None:
                 attrs[u'cubicweb:sortvalue'] = js_dumps(sortvalue)
         return attrs