diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index 830caf2f..c44c56cf 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -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 ```` 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) diff --git a/tailbone/templates/grids/b-table.mako b/tailbone/templates/grids/b-table.mako new file mode 100644 index 00000000..90f4fdb2 --- /dev/null +++ b/tailbone/templates/grids/b-table.mako @@ -0,0 +1,46 @@ +## -*- coding: utf-8; -*- + + + + + + +