Prevent the timer from updating a column

What I’m trying to do:
Is there any way to prevent the timer from updating only one column in a repeating grid from updating?
I’d like my response to remain until I click the “Send Response” button, but the timer that keeps the rest of the grid updated is clearing out the response after two seconds (the amount of the timer interval).

What I’ve tried and what’s not working:

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
share a copy of your app

I’m making some assumptions, because the screenshot doesn’t show what you’re doing in your timer code.

My main assumption is that you’re refreshing the repeating panel items with something like:

self.repeating_panel_1.items = anvil.server.call('whatever')

Basically that you’re resetting all the items every time the timer ticks. If that assumption is true, then there’s no way to preserve just one field across the rows. That field will get reset along with the rest of the items.

I can imagine a couple of approaches to maintaining the value in that field, but they boil down to converting your search results to a list (that will lose any paging benefit, so if you have a lot of results it might be slow) and then merging that list with the items property, so for those items already in the repeating panel you maintain their value. You might be able to do that inside items itself (e.g. prepending the newer items, since you seem to be ordering by date/time), or you might need to build a new list that’s the merged one and set the repeating panel’s items property to it.

Hopefully someone on the forum’s done this very thing before and has some nice code to share as a starting point.

2 Likes

Can I make a Feature Request to prevent the timer from updating certain things?

What are the things that are updated?
What does the timer do?
Without seeing the code is impossible to answer.

The timer executes a function. You have full control over what the function does. If you tell us what you want to do we can try to help you.

2 Likes