You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Zbynek Vavros <zb...@gmail.com> on 2019/03/11 09:50:51 UTC

Lazy modal window

Hi,

I see content of modal windows being created even before the window was
displayed.
Is proper way to make this lazy by using AjaxLazyLoadPanel in
ModalWindow.setContent ?

Thanks

Re: Lazy modal window

Posted by sven <sv...@meiers.net>.
 
 
Wicket doesn't force you to create the content upfront.
 
Show us some code, so we can see why you got this wrong impression.
 

 
Have fun
 
Sven
 
 
 

 
 
 
 
 
>  
> On 11.03.2019 at 13:07,  <Zbynek Vavros>  wrote:
>  
>  
>  Let's say modal windows does some quite expensive query and user never displays this window. In this case the query will be done even when not needed. Is there any other way to make sure the content isn't loaded until needed? On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov wrote:  >  Hi,  >   >  On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros  >  wrote:  >   >   >  Hi,  >   >   >   >  I see content of modal windows being created even before the window was  >   >  displayed.  >   >  Is proper way to make this lazy by using AjaxLazyLoadPanel in  >   >  ModalWindow.setContent ?  >   >   >   >  This is a matter of requirements/taste.  >  Your users would prefer to see the content as soon as possible.  >   >   >   >   >   >  Thanks  >   >   >  
>  
     

Re: Lazy modal window

Posted by Zbynek Vavros <zb...@gmail.com>.
Aha I see, the solution is to set the content panel when the ajax event
occurs...

Thanks!

On Mon, Mar 11, 2019 at 10:10 PM Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> publish you quickstart on a public repository (e.g. Github) or store it
> on a file hoster so we can take a look.
>
> But it's not hard actually - you can delay setting the content of your
> dialog until it is shown:
>
>      @Override
>      public void onClick(AjaxRequestTarget target)
>      {
>          modal2.setContent(createContent(modal2.getContentId()));
>          modal2.setWindowClosedCallback(target -> modal2.setContent(new
> WebMarkupContainer(modal2.getContentId())) );
>          modal2.show(target);
>      }
>
> Have fun
> Sven
>
>
> Am 11.03.19 um 17:20 schrieb Zbynek Vavros:
> > Well for me the code in content's panel is executed when the page
> > containing the link/button is rendered.
> > Doesn't matter if I click it or not. Maybe I do smth terribly wrong...
> >
> > I could provide quick-start I'm just not sure how it works here (do I
> > attach it to email?).
> >
> > On Mon, Mar 11, 2019 at 1:17 PM Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> >> On Mon, Mar 11, 2019 at 2:07 PM Zbynek Vavros <zb...@gmail.com>
> >> wrote:
> >>
> >>>   Let's say modal windows does some quite expensive query and user
> never
> >>> displays this window.
> >>> In this case the query will be done even when not needed.
> >>>
> >>> Is there any other way to make sure the content isn't loaded until
> >> needed?
> >> The content of the ModalWindow is shown after your application executes
> >> modalWindow.show(target), e.g. after clicking on a link/button.
> >>
> >>
> >>
> >>>
> >>> On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov <mg...@apache.org>
> >>> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros <
> zbynekvavros@gmail.com
> >>>> wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I see content of modal windows being created even before the window
> >> was
> >>>>> displayed.
> >>>>> Is proper way to make this lazy by using AjaxLazyLoadPanel in
> >>>>> ModalWindow.setContent ?
> >>>>>
> >>>> This is a matter of requirements/taste.
> >>>> Your users would prefer to see the content as soon as possible.
> >>>>
> >>>>
> >>>>> Thanks
> >>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Lazy modal window

Posted by Sven Meier <sv...@meiers.net>.
Hi,

publish you quickstart on a public repository (e.g. Github) or store it 
on a file hoster so we can take a look.

But it's not hard actually - you can delay setting the content of your 
dialog until it is shown:

     @Override
     public void onClick(AjaxRequestTarget target)
     {
         modal2.setContent(createContent(modal2.getContentId()));
         modal2.setWindowClosedCallback(target -> modal2.setContent(new 
WebMarkupContainer(modal2.getContentId())) );
         modal2.show(target);
     }

Have fun
Sven


Am 11.03.19 um 17:20 schrieb Zbynek Vavros:
> Well for me the code in content's panel is executed when the page
> containing the link/button is rendered.
> Doesn't matter if I click it or not. Maybe I do smth terribly wrong...
>
> I could provide quick-start I'm just not sure how it works here (do I
> attach it to email?).
>
> On Mon, Mar 11, 2019 at 1:17 PM Martin Grigorov <mg...@apache.org>
> wrote:
>
>> On Mon, Mar 11, 2019 at 2:07 PM Zbynek Vavros <zb...@gmail.com>
>> wrote:
>>
>>>   Let's say modal windows does some quite expensive query and user never
>>> displays this window.
>>> In this case the query will be done even when not needed.
>>>
>>> Is there any other way to make sure the content isn't loaded until
>> needed?
>> The content of the ModalWindow is shown after your application executes
>> modalWindow.show(target), e.g. after clicking on a link/button.
>>
>>
>>
>>>
>>> On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov <mg...@apache.org>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros <zbynekvavros@gmail.com
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I see content of modal windows being created even before the window
>> was
>>>>> displayed.
>>>>> Is proper way to make this lazy by using AjaxLazyLoadPanel in
>>>>> ModalWindow.setContent ?
>>>>>
>>>> This is a matter of requirements/taste.
>>>> Your users would prefer to see the content as soon as possible.
>>>>
>>>>
>>>>> Thanks
>>>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy modal window

Posted by Zbynek Vavros <zb...@gmail.com>.
Well for me the code in content's panel is executed when the page
containing the link/button is rendered.
Doesn't matter if I click it or not. Maybe I do smth terribly wrong...

I could provide quick-start I'm just not sure how it works here (do I
attach it to email?).

On Mon, Mar 11, 2019 at 1:17 PM Martin Grigorov <mg...@apache.org>
wrote:

> On Mon, Mar 11, 2019 at 2:07 PM Zbynek Vavros <zb...@gmail.com>
> wrote:
>
> >  Let's say modal windows does some quite expensive query and user never
> > displays this window.
> > In this case the query will be done even when not needed.
> >
> > Is there any other way to make sure the content isn't loaded until
> needed?
> >
>
> The content of the ModalWindow is shown after your application executes
> modalWindow.show(target), e.g. after clicking on a link/button.
>
>
>
> >
> >
> > On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros <zbynekvavros@gmail.com
> >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I see content of modal windows being created even before the window
> was
> > > > displayed.
> > > > Is proper way to make this lazy by using AjaxLazyLoadPanel in
> > > > ModalWindow.setContent ?
> > > >
> > >
> > > This is a matter of requirements/taste.
> > > Your users would prefer to see the content as soon as possible.
> > >
> > >
> > > >
> > > > Thanks
> > > >
> > >
> >
>

Re: Lazy modal window

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Mar 11, 2019 at 2:07 PM Zbynek Vavros <zb...@gmail.com>
wrote:

>  Let's say modal windows does some quite expensive query and user never
> displays this window.
> In this case the query will be done even when not needed.
>
> Is there any other way to make sure the content isn't loaded until needed?
>

The content of the ModalWindow is shown after your application executes
modalWindow.show(target), e.g. after clicking on a link/button.



>
>
> On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros <zb...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I see content of modal windows being created even before the window was
> > > displayed.
> > > Is proper way to make this lazy by using AjaxLazyLoadPanel in
> > > ModalWindow.setContent ?
> > >
> >
> > This is a matter of requirements/taste.
> > Your users would prefer to see the content as soon as possible.
> >
> >
> > >
> > > Thanks
> > >
> >
>

Re: Lazy modal window

Posted by Zbynek Vavros <zb...@gmail.com>.
 Let's say modal windows does some quite expensive query and user never
displays this window.
In this case the query will be done even when not needed.

Is there any other way to make sure the content isn't loaded until needed?


On Mon, Mar 11, 2019 at 1:05 PM Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros <zb...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I see content of modal windows being created even before the window was
> > displayed.
> > Is proper way to make this lazy by using AjaxLazyLoadPanel in
> > ModalWindow.setContent ?
> >
>
> This is a matter of requirements/taste.
> Your users would prefer to see the content as soon as possible.
>
>
> >
> > Thanks
> >
>

Re: Lazy modal window

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Mar 11, 2019 at 11:51 AM Zbynek Vavros <zb...@gmail.com>
wrote:

> Hi,
>
> I see content of modal windows being created even before the window was
> displayed.
> Is proper way to make this lazy by using AjaxLazyLoadPanel in
> ModalWindow.setContent ?
>

This is a matter of requirements/taste.
Your users would prefer to see the content as soon as possible.


>
> Thanks
>