Grid(details, editable, deletable) incompatible double-usage

23 views
Skip to first unread message

laundmo

unread,
Dec 9, 2025, 7:54:07 AM (7 days ago) Dec 9
to py4web
the Grid paramters details, editable, and deletable are used for 2 distinct purposes in an incompatible manner:
- To determine whether the row has a details/edite/delete button. In this case, they can be a boolean or a callable that takes the row and returns a boolean.
- To change the details/edit/delete button URL, in this case it needs to be a str.

I cannot at the same time determine whether a row should have the details/edit/delete button and also change the URL they point at, because i cant have a callable thats also a str. I have to choose either option.

Possible solutions:
- the simplest: the callable can return the URL as well, which will be used for the button. This works because theres no need to provide a URL if the button isn't rendered for this row.
- slightly more complex: split the params into one for checking whether the buttons should be rendered, and a second for generating the button url

Massimo DiPierro

unread,
Dec 10, 2025, 2:09:53 AM (7 days ago) Dec 10
to py4web
good catch! I like the simplest solution.

Reply all
Reply to author
Forward
0 new messages