FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
[WB19] Page Initialise Best Practice
[WB19] Page Initialise Best Practice
Débuté par Ericus, 14 juin 2017 11:44 - 2 réponses
Connectez-vous…
Ericus
#1
Posté le 14 juin 2017 - 11:44
Morning
I open a page and at the same time populate 4 loopers with data from 4 different queries based on the parameter passed to the page.
This takes a couple of seconds to do.
What is the best practice to open the page and update the loopers in the background but at least the user can see the page and the fields they are going to complete?
I have tried ThreadExecute where I execute the 4 queries and use looperdisplay to refresh the loopers. However the looperdisplay does not work from the ThreadExecute. Something to do with the HFSQL context being duplicated?
If I run the same procedure but not as a thread, then it works, but then the display is delayed by the few seconds to display the loopers.
Thanks in advance for any pointers.
Ericus Steyn
Signaler
0
0
Fabrice Harari
#2
Posté le 14 juin 2017 - 13:13
Hi Ericus,
I would use ajax to do what you want:
- either (if it's already available in 19) with an ajaxececute call with the refresh display option in the page load browser code
- or, if that option appeared later than 19, with an execute process of a hidden button, and in the button sever+AJAX code, the reading of data and filling of loopers
You can even user four successive calls using that principal, if you want to stagger the apparition of data.
Best regards
Signaler
0
0
Danny Lauwers
#3
Posté le 15 juin 2017 - 15:51
Hi,
I also tried to run an AjaxExecuteAsync call in the onLoad browser function, but for some reason this was not processed in the background :confused:, the delay before the controls where displayed was the same. You can use Chrome F12, or a Chrome Extention called Performance-Analyzer. That displays where the delay is and how your page loads etc...
Very interesting:
https://chrome.google.com/webstore/detail/performance-analyser/djgfmlohefpomchfabngccpbaflcahjf
I use the following method to run something "in the background" do this.
1) In the load (onload) event for the browser run a global Browser function from the Template (B_DisplayReload_Async)
2) In that browser function I start a timer with a very very little delay
gnAfterOnLoadTimer = Timer(B_AfterOnLoad_Timer,1)
By doing this the onload function of the browser directly returns and can display the layout.
3) After that little time (10ms) the function B_AfterOnLoad_Timer of my Template is called
4) In the function B_AfterOnLoad_Timer I do
EndTimer(gnAfterOnLoadTimer)
B_ShowWaitPopup()
// Start an async task, for updates that are delayed
Res is int
Res = AJAXExecuteAsynchronous(ajaxUpdateControls,Display_Async,B_Display_Async_Ready)
I call the B_Display_Async and B_Display_Async_Ready functions.
In the pages I need this background functionality I just override the Template function Display_Async and fill it with the code that gets the data, updates the tables/loopers etc.
During the "load" time, the user sees the page and all of its controls and is presented with a wait dialog until the data is loaded/processed. When that is done the B_Display_Async_Ready function is called.
In the B_Display_Async_Ready function, I hide the wait dialog.
I don't know if this is the best solution, but it seems to work :rp:.
I would like that PC-Soft would make some async event on the page todo this 'out-of-the-box'.
If you find any improvements on my method, please let me know !
Have a nice day
Danny
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte