Oh I see, that’s based on the Magical Concierge example app. If you want a more cut-down version of a live chat app, have a look my Live Chat app:
https://anvil.works/ide#clone:6APMATYZGK473ZLK=XYBGEZNNM7ELXGFJW6LHHIMM
In either case, you don’t need CSS to change the order from oldest-first to newest-first. You can simply reverse the order of the messages list in the Python code.
In my Live Chat app, you can change:
return app_tables.messages.search(tables.order_by('when', ascending=False), to_channel=channel)
to:
return app_tables.messages.search(tables.order_by('when', ascending=True) to_channel=channel)
in ServerModule1.
Reversing the list order is a bit trickier in the Magical Concierge app because it’s only fetching the messages it doesn’t know about, rather than refreshing the entire message list each time. I’ll leave that one as an excercise for the reader ( ), but here’s a hint: you can import the Data Tables query operators:
import anvil.tables.query as q
which will help with finding which messages have been created since last_seen_event
.