How to refresh a data grid automatically without refresh the page

I have one web app for clients to give a feedback and one web app for business where i have all the feedbacks. I want to update the data grid when a client send the feedback form and my database is populated. Like…if i am on my web app and a client submit a feedback form i want to see in that moment.

I tried with self.refresh_data_bindings() but nothing happens.

If i try with a timer and recall the method to repopulate the data grid the web app will load every N seconds and i want to load just when the client clicked on send.

The database is the same.

It is possible to update just when the client clicks on send from another web app?

Thanks!

https://anvil.works/build#clone:ACROMMS5CZTWUEIQ=N2HX6EJWOETLYQSYC7KVS323

Hi,

If you have your panel items defined, you can refresh them on your submit event.

Like:

def refreshitems(self,**args):
   self.panel.items = anvil.server.call('getsubmissisons')

def newsubmission(self,**args):
   #do your submission routine bits
   self.refreshitems()

You’ll get the display updated at the point of submission every time.

Running over two apps, you’ll have to build some sort of trigger to refresh the view, so polling via timer is actually a pretty solid option.

1 Like

Thanks mate! I will try this. I have another question, i have a button in the repeating_panel when i click on him i want to show the infos form the row. But how can i access the label from the Main form …my method in on the repeating panel and i can’t see the label. Thanks!

So, if you had a form for displaying the row data set up, the easiest way is to import that form in your Row Template where the button lives and open the form as an Alert. That way you can sling all the row data in as self:

from .. import ViewSubmission

then on your button click:

Alert(content=ViewSubmission(item = self.item),large=True)

1 Like

I want when i click on the button from the repeating list in my label bellow the datagrid to apear that info.
Like this:


I tried everything…import the main form, i made a global module…but nothings seems to work…
Thanks Patrick!

In that case, I’d be tempted to replace the grid with a repeating panel and have a card in the customised row with your components which is simply made visible=True when you click View.

I use these all the time but actually prefer forms in alerts for a variety of reasons to do with use cases.

1 Like