Add support for column header title (tooltip) in new grids
This commit is contained in:
parent
073358417c
commit
7676312dd7
|
@ -181,7 +181,8 @@ class AlchemyGrid(Grid):
|
|||
Returns an iterator for all currently-visible columns.
|
||||
"""
|
||||
for field in self._fa_grid.render_fields.itervalues():
|
||||
column = GridColumn(field.key, field.label())
|
||||
column = GridColumn(field.key, label=field.label(),
|
||||
title=getattr(field, '_column_header_title', None))
|
||||
column.field = field
|
||||
yield column
|
||||
|
||||
|
|
|
@ -578,7 +578,9 @@ class Grid(object):
|
|||
else:
|
||||
kwargs['class_'] = 'sortable'
|
||||
kwargs['data-sortkey'] = column.key
|
||||
kwargs['c'] = tags.link_to(column.label, '#')
|
||||
kwargs['c'] = tags.link_to(column.label, '#', title=column.title)
|
||||
elif column.title:
|
||||
kwargs['c'] = HTML.tag('span', title=column.title, c=column.label)
|
||||
return HTML.tag('th', **kwargs)
|
||||
|
||||
@property
|
||||
|
@ -685,9 +687,10 @@ class GridColumn(object):
|
|||
Human-facing label for the column, i.e. displayed in the header.
|
||||
"""
|
||||
|
||||
def __init__(self, key, label=None):
|
||||
def __init__(self, key, label=None, title=None):
|
||||
self.key = key
|
||||
self.label = label or prettify(key)
|
||||
self.title = title
|
||||
|
||||
def render(self, value):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue