fix Grid.get_row_attrs()
This commit is contained in:
parent
efd06fad4b
commit
e2c0aa14ba
2 changed files with 7 additions and 3 deletions
|
@ -49,6 +49,7 @@ class Grid(edbob.Object):
|
||||||
checkboxes = False
|
checkboxes = False
|
||||||
deletable = False
|
deletable = False
|
||||||
partial_only = False
|
partial_only = False
|
||||||
|
row_attrs = None
|
||||||
|
|
||||||
def __init__(self, request, **kwargs):
|
def __init__(self, request, **kwargs):
|
||||||
kwargs.setdefault('fields', OrderedDict())
|
kwargs.setdefault('fields', OrderedDict())
|
||||||
|
@ -98,5 +99,8 @@ class Grid(edbob.Object):
|
||||||
attrs = {'class_': 'odd' if i % 2 else 'even'}
|
attrs = {'class_': 'odd' if i % 2 else 'even'}
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def row_attrs(self, row, i):
|
def get_row_attrs(self, row, i):
|
||||||
return format_attrs(**self._row_attrs(row, i))
|
attrs = self._row_attrs(row, i)
|
||||||
|
if self.row_attrs:
|
||||||
|
attrs.update(self.row_attrs(row, i))
|
||||||
|
return format_attrs(**attrs)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
% for i, row in enumerate(grid.iter_rows(), 1):
|
% for i, row in enumerate(grid.iter_rows(), 1):
|
||||||
<tr ${grid.row_attrs(row, i)}>
|
<tr ${grid.get_row_attrs(row, i)}>
|
||||||
% if grid.checkboxes:
|
% if grid.checkboxes:
|
||||||
<td class="checkbox">${grid.checkbox(row)}</td>
|
<td class="checkbox">${grid.checkbox(row)}</td>
|
||||||
% endif
|
% endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue