mterceno Posted October 19, 2018 Posted October 19, 2018 Hi all, Is it possible to synchronously call a similar function "ajaxRequest" ? For example, if a TuniForm has a few TUniEdit, I would like that when enter(focus) in second (event), the client call the server method via ajaxRequest() and the client stays waiting as long as the call of ajaxRequest is not terminated. In this case f.e., impossible to press tab to focus in next TUniEdit. Do you think that possible ? Thank you Quote
Sherzod Posted October 19, 2018 Posted October 19, 2018 Hi, If I understand you correctly, You can try this: ajaxRequest(obj, "event", [], false); Quote
VVR Posted October 19, 2018 Posted October 19, 2018 Hello (mterceno co-worker here ;-) ) It seems that adding the "false" parameter to the ajaxRequest method ensure that the code in OnAjaxEvent() is executed before any other client-side request. But the problem is that all CS requests made during the process (mouse clics, keyboard inputs, ... queued I guess) are still executed after the OnAjaxEvent() code is done. How could we stop the UI from catching all events during OnAjaxEvent() execution? I tried this approach (using a mask) to no avail (simple test with a button click): JS: function click(sender, e, eOpts) { MainForm.form.showMask(); ajaxRequest(sender, 'myclickevent', [], false); } Delphi: procedure TPurchaseEntriesFrame.UniButtonTestAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin inherited; if EventName = 'myclickevent' then try UniLabel7.Caption := UniLabel7.Caption + ' myclickevent'; Sleep(1000); finally UniSession.AddJS('MainForm.form.hideMask();'); end; end; For example, if the user clicks on the button again while UniButtonTestAjaxEvent() is performed, the second click event is still catched and fired after. (mask is not shown) Quote
VVR Posted October 19, 2018 Posted October 19, 2018 PS: I know I could just remove the "false" parameter from ajaxRequest() but this doesn't work 100% of the time (I tried with grid operations like deleting a record from a button). If the user clicks two times super-fast some problems occurs (code is executed twice but UI is not refreshed etc.) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.