Skip to content

Commit

Permalink
allow lambda on td_class_style on Column (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsteil authored May 16, 2024
1 parent a46eff6 commit f90862c
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions py4web/utils/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,25 @@
from urllib.parse import urlparse

from pydal.objects import Expression, Field, FieldVirtual
from yatl.helpers import (CAT, DIV, FORM, INPUT, OPTION, SELECT, SPAN, TABLE,
TAG, TBODY, TD, TH, THEAD, TR, XML, A, I)
from yatl.helpers import (
CAT,
DIV,
FORM,
INPUT,
OPTION,
SELECT,
SPAN,
TABLE,
TAG,
TBODY,
TD,
TH,
THEAD,
TR,
XML,
A,
I,
)

from py4web import HTTP, URL, redirect, request, safely
from py4web.utils.form import Form, FormStyleDefault, join_classes
Expand Down Expand Up @@ -1201,11 +1218,15 @@ def _make_table_body(self):
elif isinstance(column, Column):
classes = self.param.grid_class_style.classes.get(
column.td_class_style,
self.param.grid_class_style.classes.get("grid-td"),
column.td_class_style(row)
if callable(column.td_class_style)
else self.param.grid_class_style.classes.get("grid-td"),
)
style = self.param.grid_class_style.styles.get(
column.td_class_style,
self.param.grid_class_style.styles.get("grid-td"),
column.td_class_style(row)
if callable(column.td_class_style)
else self.param.grid_class_style.styles.get("grid-td"),
)
tr.append(
TD(
Expand Down

0 comments on commit f90862c

Please sign in to comment.