![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Mon, Mar 18 2019 1:35 AM | Permanent Link |
Robert Horbury-Smith | Environment :
I'm consuming RPC Requests from a mORMot back end, and untill now, have managed to resolve all my issues. My program structure has single proceedures to do stuff, and reuses procedures from different parts of the GUI as required via buttons in different Page Pannels that call a procedure. My current task is to fill 4 grids: ( lets say for example Customers, Invoices, Orders and Locations) on a single Page (TPagePanel). Each of these methods invokes a RPC Request for that particular table, and returns the JSON, which is then loaded to the respective dataset (LoadRows). When each of these methods is invoked from a click event via it's own dedicated button (for testing purposes), everything works fine - so the procedures are doing what they're supposed to do. But when I invoke all 4 proceedures from a single button click, only the final grid gets populated. Example : procedure TfrmMain.btnFillALLGridsClick(Sender: TObject); Var Cust, ... (search params) begin {Calling 4 procedures} RequestCust(Cust); RequestInvoice(Cust); ... RequestLocations(Cust); {This last function is the only one that updates the Form.} End; So I'm guessing that there must be some internal event triggered after a button click that causes the page to refresh or process events (and that I need to make some kind of call after executing each method) - but I can't find it. Any advice would be greatly appreciated Robert |
Mon, Mar 18 2019 4:06 AM | Permanent Link |
ooptimum | There's no special magic in there, nor special procedures. It's still a regular Javascript event loop under the hood, nothing new in there.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop As soon as your button press handler begins its execution, you cannot interrupt it to handle any other events. These events will be processed when your handler finishes its work. I think you have a bug in your server data request code. For instance, you may be reusing the same object before you finish receiving the previous portion of the data. |
Mon, Mar 18 2019 8:05 AM | Permanent Link |
Robert Horbury-Smith | Thanks ooptimum, I see what's going on now (great link BTW).
Writing to a log on the Server confirms that new requests are messing up the earlier responses (executing before the prior response has completed). So yes - I was barking up the wrong tree and your response has pointed me in the right direction. I'm guessing that I need to queue the requests on the Client side. Just started reading TServerRequest in the EWB Docs. Getting late here (after 11:00 PM), so will try to digest this info in the morning and do some experimentation. Robert |
Mon, Mar 18 2019 11:50 AM | Permanent Link |
Matthew Jones | Robert Horbury-Smith wrote:
> I'm guessing that I need to queue the requests on the Client side. Just started reading TServerRequest in the EWB Docs. Or support a threaded and independent call system on the server, which would be better. The browser should be able to request multiple things at the same time, and the server can respond to each independently. You need this for many reasons, including multiple users. -- Matthew Jones |
Tue, Mar 19 2019 12:02 AM | Permanent Link |
Robert Horbury-Smith | "Matthew Jones" wrote:
> Or support a threaded and independent call system on the server, which would be better. The browser should be able to request multiple things at the same time, and the server can respond to each independently. You need this for many reasons, including multiple users. Thanks Matthew. Lots of conncurrency and threading options available on the Server (and it would be nice to let the Server handle these situations if they occur). But for Client side batch transactions, I'd rather handle these on the Client for performanse reasons, so will try to impliment the EWB TServerRequestQueue to handle this. Cheers Robert |
Thu, Mar 21 2019 11:13 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Robert,
<< But for Client side batch transactions, I'd rather handle these on the Client for performanse reasons, so will try to impliment the EWB TServerRequestQueue to handle this. >> That's exactly the solution (using TServerRequestQueue) and is why that component was introduced. It gives you a way to execute requests as 1.2.3.4... without having to do callback chaining. Tim Young Elevate Software www.elevatesoft.com |
Fri, Mar 22 2019 2:37 AM | Permanent Link |
Robert Horbury-Smith | Tim Young [Elevate Software] wrote:
<<That's exactly the solution (using TServerRequestQueue) and is why that component was introduced. It gives you a way to execute requests as 1.2.3.4... without having to do callback chaining.>> Thanks Tim - that's good to know. Looked at the example. Not quite so easy for me to impliment as I'm using Erick Engelke's ewbmormot.wbs (EWBMormot Book) for mORMot back end interaction. So I may just do procedure chaining for now, but for those using a simular architecture I'll report back once I have a better solution. Robert |
This web page was last updated on Thursday, March 30, 2023 at 10:19 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |