This is the kind of code you would write if you are not using Anvil’s data bindings. All data movement is then your responsibility.
If you are using Anvil’s data bindings, e.g., where self.item['Company_Name']
is entered in the “to” field mentioned earlier, then Anvil is already doing this kind of assignment
self.item['Company_Name'] = ...
...
... .text = self.item['Company_Name']
for you. This is, in fact, the purpose of Anvil’s Data Bindings: doing them behind the scenes, so that you don’t have to write actual code to do it.
The spinner results from this part:
where assigning to self.item
triggers the event refreshing_data_bindings
, which triggers a call to form_refreshing_data_bindings(). Each time it is triggered, it does another database search, the result of which… ultimately triggers the same search… which triggers the same search… The function never gets a chance to finish!
Generally, assign to self.item
only when it has to change to a different row, or when you need to trigger the event refreshing_data_bindings
for some other reason.