The account_orgs
column of your accounts
table contains orgs
data table rows. The data grid is accordingly displaying a string representation of those orgs
rows (“If you use a non-string value in the dictionary, the DataRowPanel calls str()
on it before displaying it.” Anvil Docs | Data Grids) See the docs linked there for how to instead custom format the display of account_orgs
in this data grid. For instance, you can drag a Label into that column in user_accounts_row_template
and then add code (to the template) to set this Label’s text
attribute to self.item['account_orgs']['org_name']
.
(Alternatively, you could specify this in the server function, as it sounds like you have already tried. To accomplish the “one extra complexity,” I think you’ll have to do something similar–either client- or server-side. But someone else may have a better pattern to suggest. For instance, perhaps you could use something like an ORM, defining a portable class for orgs
objects so that they would “know” that ‘org_name’ is their proper string representation. But I think you’d have to code that yourself–or else work from the anvilistas ORM developed by @owen.campbell.)
On the query issue, your code is currently only returning rows for which that column matches the list of orgs stored for that user. To get your desired result, “unpacking” the list using a preceding * should do the trick: q.any_of(*user['user_orgs'])
.