diff --git a/edbob/pyramid/grids/core.py b/edbob/pyramid/grids/core.py index 2aeeb25..9cb0e94 100644 --- a/edbob/pyramid/grids/core.py +++ b/edbob/pyramid/grids/core.py @@ -49,6 +49,7 @@ class Grid(edbob.Object): checkboxes = False deletable = False partial_only = False + row_attrs = None def __init__(self, request, **kwargs): kwargs.setdefault('fields', OrderedDict()) @@ -98,5 +99,8 @@ class Grid(edbob.Object): attrs = {'class_': 'odd' if i % 2 else 'even'} return attrs - def row_attrs(self, row, i): - return format_attrs(**self._row_attrs(row, i)) + def get_row_attrs(self, row, i): + attrs = self._row_attrs(row, i) + if self.row_attrs: + attrs.update(self.row_attrs(row, i)) + return format_attrs(**attrs) diff --git a/edbob/pyramid/templates/grids/grid.mako b/edbob/pyramid/templates/grids/grid.mako index 84c12f6..78542b4 100644 --- a/edbob/pyramid/templates/grids/grid.mako +++ b/edbob/pyramid/templates/grids/grid.mako @@ -18,7 +18,7 @@ % for i, row in enumerate(grid.iter_rows(), 1): - + % if grid.checkboxes: ${grid.checkbox(row)} % endif