Very likely these two posts describes what you need:
Round trips between the form and the Anvil server are usually the bottleneck.
The best way to optimize performances is to collect all you need inside one dictionary, make one call to one server function, the server function will use the dictionary to do whatever it needs to do, then gather all the info it needs to gather, collect it inside a dictionary and return it to the client.
This way you have one round trip only. It might be slightly slower, but it will usually be much faster than splitt…
If you give a query to a repeating panel, you don’t have the data yet. The data will be fetched when the repeating panel asks for it. I don’t know the details, but Anvil might fetch one line at a time or a block of lines.
Also, if you have a column with a link to another table, the other table row will be accessed only on request. For example a user['friends'] that returns a list of rows from another table will require another query.
The work is the same, but collecting the data for a dict o…
Here are other posts that talk about client-server communication optimization.
The DataGrid pagination only works with small lists. When I work with larger lists I use a repeating panel.
But if the DataGrid is almost good for you and you just want to make the user feel it a little snappier, you can use two server calls, the first one that loads only enough rows for the first page, followed by a self.timer1.interval = 0.01.
Then, after the UI has finished rendering the first page, the tick event of the timer will load the remaining rows with another call.
It is not going…
Background tasks cannot interact with the form because they run on the server, not on the client.
The code on the client calls a function on the server, that function starts the background task and returns something to the client, the code on the client changes something on the form and ends. There is no way for the background task to contact the client and send some information.
You could use a timer on the form to call another server function that checks the status of the background task or …
This post is very old. The concepts it describes are still valid, but it’s worth adding that today rendering the forms in a repeating panel is much faster, the DataGrid in general works better and this custom component shows how to do the automatic scrolling: Auto Scroll - Automatically add content as the user scrolls the mouse wheel
Using the Data Grid can be slow for two reasons: retrieving the data can take too long with list comprehension and the creation of many row item forms can be slow…
EDIT
@shaun and @bridget , I listed only my posts because those are the ones I know, but it would be nice to have a few posts organized by topic (performance, data tables, DataGrid, javascript, custom components, etc.) listing the best posts about each topic. These should be maintained as Anvil grows and they get stale.
9 Likes