Start from the end:
You need to update a row of a table:
row['Read'] = ...
You need that ...
and you need that row
:
row = app_tables.usermessages.get_by_id(row_id) # use this if you use the default row id created by Anvil
row = app_tables.usermessages.get(row_id=row_id) # use this if you want to identify the rows with your own unique column
row['Read'] = value
You need row_id
and value
:
@anvil.server.callable
def update_user_msg_read(row_id, value):
row = app_tables.usermessages.get(row_id=row_id)own unique column
row['Read'] = value
You need to provide those values:
def button_1_click(self, **event_args):
anvil.server.call('update_user_msg_read', row_id=row_id, value=True)
anvil.server.call('update_user_msg_read', row_id, True) # this is equivalent, to the previous, use whichever you like
Now the question is where do you get row_id
or whatever identifier will allow you to get your row back from the database when you need it.
If you are inside a repeating panel, it should be something like self.item['row_id']
or self.item['email_address']
or self.item['name']
or… you get the gist.
If you are not inside a repeating panel, then… well, it depends on where you are.
The point of this answer is not to give you a direct answer to this very question, it’s more to give you a thought process so you can find the answer yourself.
Sometimes it’s easy to think “I made it this far, let’s see what’s the next step with what I already have”
But sometimes it’s better to think “That’s where I want to go, let’s see what I need to get there and let’s make sure I have it on all the steps that will lead me there”