Add <b-table> element template for simple grids with "static" data

This commit is contained in:
Lance Edgar 2019-06-04 13:33:56 -05:00
parent e5472a6fae
commit 1c07508f39
2 changed files with 63 additions and 3 deletions

View file

@ -946,6 +946,18 @@ class Grid(object):
return self.render_complete(template=template, **kwargs)
def render_buefy_table_element(self, template='/grids/b-table.mako', data_prop='gridData', **kwargs):
"""
This is intended for ad-hoc "small" grids with static data. Renders
just a ``<b-table>`` element instead of the typical "full" grid.
"""
context = dict(kwargs)
context['grid'] = self
context['data_prop'] = data_prop
if 'grid_columns' not in context:
context['grid_columns'] = self.get_buefy_columns()
return render(template, context)
def get_filters_sequence(self):
"""
Returns a list of filter keys (strings) in the sequence with which they
@ -1133,9 +1145,11 @@ class Grid(object):
# set action URL(s) for row, as needed
self.set_action_urls(row, rowobj, i)
status = self.extra_row_class(rowobj, i)
if status:
status_map[i] = status
# set extra row class if applicable
if self.extra_row_class:
status = self.extra_row_class(rowobj, i)
if status:
status_map[i] = status
data.append(row)