Updating records in DB - updating display on clients side

I have a a repeating data row that is bound to a data base table. When a user edits a record the DB is updated using a server side record.update() call. In order to refresh the data row display back to the user , currently I do get records call and the whole display refreshes. Is there away to just refresh that particular record and not the whole display?

2 Likes

I think you can just update teh repeating panel’s items with the new row.

You could see here for some related discussion and an example app to see if it helps.

If I understand you correctly, you are suggesting that I update the DB and the self.repeating_panel.items at the same time as theses are separate data structures and then refresh the data bindings on the repeating panel which will use the repeating panels items to populate the repeating panel rows.

let me add; I am not looking for increased speed in reloading the user display, rather a nicer looking display - if just the one row edited changes rather then the whole repeating panel re-rendering.

@boruchwoolstone
One thing that comes to mind - what about using writeback with data bindings - using app_tables.ExampleTable.client_writable(user=user).search() in the initial server call when fetching from the database.

Meredydd did something similar in the tutorial for StockPortoflio around 26mins30 in https://anvil.works/learn/examples/stock-portfolio

This way, the elements in the form can write to the database and objects will be up to date. And keeps the security since they are only able to write to the database if the user has permission.

2 Likes