Please advice how to show loader (default and/or custom) while running long task when i click button for example
Thanks in advance!
I noticed that loader shows only running long task in a “Window”; but with same code on a “Page”, loader doesn’t shows
Thanks in advance!
Strange, sometimes shows and sometimes doesn’t shows
Using Wisej version 1.3.17
The loader shown automatically by Wisej is related to the response time. It shows when the response takes longer than loaderTimeout: http://wisej.com/docs/html/Configuration.htm. Wisej never blocks the client and requests/responses are processed in parallel, there is no serial sequence that blocks. Otherwise you wouldn’t be able to resize a window or scroll or operate the web site since Wisej sends multiple small packets back and forth to fulfill the real time web app approach.
Only multiple button clicks processed in PerformClick() are discarded if a second click comes it while the method is still processing.
When you see the loader appearing and then disappearing it means that the first request took longer than the configuration loaderTimeout and then a second request cleared the loader. It usually shows up when a grid asks for data if the query on the server takes long, etc. Ideally it should almost never show.
If you are running a long task it doesn’t mean that the app should block automatically. But if you need to, you can either set the cursor of the page to Cursors.WaitCursor, or you can show a non-modal dialog with the modal mask on, or you can show a progress bar, or just a message, and close when done.
To block the page when showing a non-modal form set ShowModalMask = true.
Remember to call Application.Update() if your process is not returning right away. Otherwise you can execute background tasks using Application.StartTask().
Having said all that :), here is how to show and hide the ajax loader on any component, you can show it for a whole page, a single window, or a single control:
this.Call("showLoader"); Application.Update(this); // ... long running stuff... this.Call("hideLoader");
Or, to show it only a button that you clicked:
this.button1.Call("showLoader"); Application.Update(this); // ... long running stuff... this.button1.Call("hideLoader");