Formatters by Type

67 views
Skip to first unread message

Weemo

unread,
May 4, 2022, 2:20:02 PM5/4/22
to py4web
Hi,

can someone tell me what needs to get done to use Font Awesome on a grid. I saw an example for Simple Tables and all I can see is:

grid.formatters_by_type["boolean" = (lambda value: SPAN(I(_class="fas fa-check-circle")) if value else "" )

When I use this on my code, I dont get the font awesome displayed. I still get True or False



thanks

Jim Steil

unread,
May 4, 2022, 5:35:35 PM5/4/22
to py4web
The fontawesome CDN url should be in layout.html if you created your app from _scaffold.

That is all you should need.

If it isn't there, here is the CDN link for the latest version of fontawesome

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />

Weemo

unread,
May 4, 2022, 7:02:28 PM5/4/22
to py4web
It is there. Hmm I am using your two examples. The simple database and the htmx. Its almost as if the htmx one changes each class while the simple database keeps its class as it is. Thats as far as I have been able to dig into this.

Thanks

Jim Steil

unread,
May 5, 2022, 8:17:42 AM5/5/22
to py4web
Using Firefox, press F12 after your page loads and click on the Style Editor tab.  Do you see all.min.css in the list on the left?

-Jim

Weemo

unread,
May 5, 2022, 11:26:23 AM5/5/22
to py4web
Thanks Jim,

it is indeed there. Hmmm

Jim Steil

unread,
May 5, 2022, 11:28:02 AM5/5/22
to py4web
Do you have any code you can share?

-Jim

Weemo

unread,
May 5, 2022, 11:39:55 AM5/5/22
to py4web
Got it Jim. Just got it early today after spending so much time on it. It was an error on my column code

Weemo

unread,
May 5, 2022, 11:45:11 AM5/5/22
to py4web
I was using:

lambda row: XML(f"{row.package_det.ready}"),
required-fields=[db.package_det.ready]

Left it with just 

db.package_det.ready


and it worked.


thanks

Jim Steil

unread,
May 5, 2022, 11:50:08 AM5/5/22
to py4web
Right - using the Column() converted it to a string.

-Jim

Weemo

unread,
May 5, 2022, 12:08:56 PM5/5/22
to py4web
Got it! thanks

On Thursday, May 5, 2022 at 5:17:42 AM UTC-7 ato....@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages