A grid layout problem

39 views
Skip to first unread message

David Manns

unread,
Jun 5, 2024, 9:17:03 AM6/5/24
to py4web
I have a problem with this grid:
grid = Grid(path, db.Events.id>0,
orderby=~db.Events.DateTime,
headings=['Datetime', 'Event', 'Venue', 'Paid', 'TBC', 'Conf', 'Wait'],
columns=[db.Events.DateTime,
Column('event', lambda row: A(row.Description, _href=URL(f"event_reservations/{row['id']}"),),
td_class_style="grid-cell-type-string"),
db.Events.Venue,
Column('Paid', lambda row: event_revenue(row.id) or ''),
Column('TBC', lambda row: event_unpaid(row.id) or ''),
Column('Conf', lambda row: event_attend(row.id) or ''),
Column('Wait', lambda row: event_wait(row.id) or '')],
search_queries=[["Event", lambda value: db.Events.Description.ilike(f'%{value}%')],
["Venue", lambda value: db.Events.Venue.ilike(f'%{value}%')],
["Speaker", lambda value: db.Events.Speaker.ilike(f'%{value}%')]],
details=not write, editable=write, create=write,
deletable=lambda r: write and db(db.Reservations.Event == r['id']).count() == 0 and db(db.AccTrans.Event == r['id']).count() == 0,
validation=validation,
grid_class_style=grid_style,
formstyle=form_style,
)


Form & Grid style are Bulma.

What I am doing is displaying the string row.Description as a link rather than just as a string by defining a Column.

As can be seen in the attached screen shot, the Event column is not wrapped to make it narrow like the adjacent Venue column is. I tried to use td_class_style to make the two columns behave the same way. The screen shot used 'inspect' to display the underlying html. Based on that I also tried td_class_style="grid-cell-type-string grid-col-Events_Event is-small" but that simply made the class is-small without any style.

Is there a way to make the Column behave the same way displayed the simple text field does?

Screenshot 2024-06-05 at 8.46.54 AM.png

David Manns

unread,
Jun 5, 2024, 12:31:55 PM6/5/24
to py4web
I figured out the solution. no.css was setting white-space:nowrap to the <a ...> tag, so:
Column('event', lambda row: A(row.Description, _href=URL(f"event_reservations/{row['id']}"),
_style="white-space: normal")),


I overrode this with _style in the helper.

Thanks!
David
Reply all
Reply to author
Forward
0 new messages