I could use onAfterRender() but I can't call JS from that. On Wed, May 30, 2018 at 5:00 PM, Zbynek Vavros <zbynekvav...@gmail.com> wrote:
> Hey, > > this is weird, I can see the Ajax loading during renderHead() processing > and then switch to my loading. > > Maybe I could describe what I'm doing in more details (with > AjaxLazyLoadPanel being used): > Loader from AjaxLazyLoadPanel is displayed. > Remote REST is being called, response from REST is passed to JS function - > at this moment my panel is rendered. > JS then calls remote service via websocket, receives response, passed that > response to Wicket JS callback function. > This calls yet another REST endpoint and saves result into DB. > > After that I replace my loading with success message. > > I would like to "ideally" have all this covered by single loading panel. > > Zbynek > > > On Wed, May 30, 2018 at 3:32 PM, Martin Grigorov <mgrigo...@apache.org> > wrote: > >> Hi, >> >> Do you use AjaxLazyLoadPanel for the loading image + result panel ? >> You can move your #renderHead() logic to the result panel's renderHead(). >> >> On Wed, May 30, 2018 at 3:05 PM, Zbynek Vavros <zbynekvav...@gmail.com> >> wrote: >> >> > Hi, >> > >> > I got a wizard and one of its steps display loading image while >> > processing long running task. After this task JavaScript is being >> called. >> > >> > I've put the code into render renderHead() method of the step itself: >> > >> > @Override >> > public void renderHead(IHeaderResponse response) { >> > // process task >> > String taskResult = ... >> > // call JavaScript with result >> > response.render(OnDomReadyHeaderItem.forScript("jsFunction(" + >> > taskResult + ")")); >> > } >> > >> > When I click the NEXT button, this long running task is executed before >> > the step with loading image is rendered. >> > I guess I need to move the code somewhere else than renderHead() but >> where? >> > >> > Thanks, >> > Zbynek >> > >> > >