[views] Fix width in tableview cubicweb-brainomics-debian-version-0.10.0-1 cubicweb-brainomics-version-0.10.0
authorVincent Michel <vincent.michel@logilab.fr>
Wed, 04 Jun 2014 19:57:29 +0000
changeset 991 12ad339cf637
parent 989 02b5a104b0b7
child 992 bc35ed6163bd
[views] Fix width in tableview
views/tableviews.py
--- a/views/tableviews.py	Wed Jun 04 19:48:06 2014 +0000
+++ b/views/tableviews.py	Wed Jun 04 19:57:29 2014 +0000
@@ -35,6 +35,9 @@
 ###############################################################################
 ### GENOMIC MEASURE - CGH #####################################################
 ###############################################################################
+def render_width(w, entity):
+    w(unicode(entity.genomic_region[0].width))
+
 class AbstractCghTableView(EntityTableView):
     __abtract__ = True
     layout_id = 'filter_table_layout'
@@ -46,14 +49,17 @@
     __regid__ = 'genmeas-table-view'
     layout_id = 'filter_table_layout'
     columns = ['genomic_region', 'cgh_ratio', 'log2_ratio', 'width', 'status', 'numprobes']
-    column_renderers = {'genomic_region': RelationColRenderer(role='subject')}
+    column_renderers = {'genomic_region': RelationColRenderer(role='subject'),
+                        'width':  EntityTableColRenderer(renderfunc=render_width)}
+
 
 
 class GeneCghTableView(AbstractCghTableView):
     __regid__ = 'gene-genmeas-table-view'
     columns = ['genomic_region', 'related_measure', 'cgh_ratio', 'log2_ratio', 'width', 'status']
     column_renderers = {'related_measure': RelationColRenderer(role='subject', vid='incontext'),
-                        'genomic_region': RelationColRenderer(role='subject', vid='incontext')}
+                        'genomic_region': RelationColRenderer(role='subject', vid='incontext'),
+                        'width':  EntityTableColRenderer(renderfunc=render_width)}
 
 
 class RegionCghTableView(EntityTableView):