Progressbar for load datasource in screen

Hello, the users of the application make the following request to me: when a screen containing a datasource that takes time to load (between 5 and 10 seconds) is shown, that the progress bar that comes out at the top could be modified and displayed In the central part of the screen in the form of spinner, message or bar blocking the screen until the datasource finishes loading. We have many screens in which the datasource takes about 5 to 10 seconds to show itself, users do not know what is happening (they do not look at the top progress bar) and close the screen before the datasource finishes loading. Elsewhere we use background tasks but for operations that take much longer, we wanted something quick to always show that the datasources are being loaded.
Greetings and thanks

1 Like

Hi,

If you want to load data in background you can use BackgroundTasks: Background Tasks - CUBA Platform. Developer’s Manual But it cannot be used with data sources directly, so you will need to load data manually in BackgroundTask and then include it to a data source.

Why does your data loading take a lot of time? Did you profile your data base access? I recommend that you enable SQL logging in eclipse link and try to figure out why is it slow. You can turn on SQL logging in tomcat/conf/logback.xml, just change level to DEBUG for eclipselink.sql logger. When you restart your tomcat instance you will see SQL statements for your queries in tomcat/logs/app.log file.

Hello Yuriy, I explain better: what I am looking for is a general method for displaying a progress bar or a message “loading data …” when a screen is started and data is being loaded, for example in a table from Datasource, without having to resort to backgraund tasks. Some loads on the screen are very fast, but others take a little more “2,3,4 seconds”, I assure you that the sql are very optimized but they influence many things that we can not control, the application is in a server shared with other applications Which are not so “polished” and we do not have access to them to improve them. That is why the same screen there are times that it is “instantaneous” in charge and other times it may take 3 or 4 seconds and then believe that it does not respond. As I told you at the beginning we look for a method that when loading the screen allows us to show the progress bar or a message so that the user knows that the data is being loaded, when the load is instantaneous the user will not give time to see the message , But if it takes longer it will be displayed and the user will know what is going on.
Thank you Yuriy.

Currently it cannot be done due to server-side nature of data loading and the only way to achieve async data loading is to use BackgroundTasks, but it requires manual data loading in your screens. That is trade-off and you should decide - optimize your data loading process or write code for async loading.

Hi Jose.

Did you find a way to show a more visible progress bar in those cases where the loading takes a few more seconds ?

Thanks