You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by rjilani <ji...@lifebiosystems.com> on 2009/02/19 17:14:17 UTC

Making an invisible panel visible via AjaxLink

Hi: Gurus I am trying to make an invisible panel visible via Ajax link, but
got stuck at a point where I don't know how to proceed further. Please see
the code snipet below

final RegisteredUserPanel registeredUserPanel = new
RegisteredUserPanel("registrationPanel");
        
        add(registeredUserPanel);
        registeredUserPanel.setOutputMarkupId(true);
        registeredUserPanel.setVisible(false);

add(new AjaxLink("registerLink") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                registeredUserPanel.setVisible(true);
                target.addComponent(registeredUserPanel);
            }
        });

the problem is that when I call registeredUserPanel.setVisible(false),
becuase by defualt I don't want this pannel to be visible; the wicket don't
render the html markup for the pannel at all and hence the ajax calls fails
becuase it don't find the markup to render the panel. Any suggestions how to
tackle a situation like this.

Regards,
RJ
-- 
View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22103906.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Making an invisible panel visible via AjaxLink

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Maybe setOutputMarkupPlaceholderTag(outputTag) can help you?


On Thu, Feb 19, 2009 at 5:14 PM, rjilani <ji...@lifebiosystems.com> wrote:

>
> Hi: Gurus I am trying to make an invisible panel visible via Ajax link, but
> got stuck at a point where I don't know how to proceed further. Please see
> the code snipet below
>
> final RegisteredUserPanel registeredUserPanel = new
> RegisteredUserPanel("registrationPanel");
>
>        add(registeredUserPanel);
>        registeredUserPanel.setOutputMarkupId(true);
>        registeredUserPanel.setVisible(false);
>
> add(new AjaxLink("registerLink") {
>
>            @Override
>            public void onClick(AjaxRequestTarget target) {
>                registeredUserPanel.setVisible(true);
>                target.addComponent(registeredUserPanel);
>            }
>        });
>
> the problem is that when I call registeredUserPanel.setVisible(false),
> becuase by defualt I don't want this pannel to be visible; the wicket don't
> render the html markup for the pannel at all and hence the ajax calls fails
> becuase it don't find the markup to render the panel. Any suggestions how
> to
> tackle a situation like this.
>
> Regards,
> RJ
> --
> View this message in context:
> http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22103906.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Making an invisible panel visible via AjaxLink

Posted by rjilani <ji...@lifebiosystems.com>.
Thanks Martijn it was cute:-) next time I remember it.

BTW my Kudos to you for writing such an awesome book on Wicket. Really good
work.

Best Regards,
RJ.


Martijn Dashorst wrote:
> 
> http://tinyurl.com/dmhfub
> 
> On Thu, Feb 19, 2009 at 5:14 PM, rjilani <ji...@lifebiosystems.com>
> wrote:
>>
>> Hi: Gurus I am trying to make an invisible panel visible via Ajax link,
>> but
>> got stuck at a point where I don't know how to proceed further. Please
>> see
>> the code snipet below
>>
>> final RegisteredUserPanel registeredUserPanel = new
>> RegisteredUserPanel("registrationPanel");
>>
>>        add(registeredUserPanel);
>>        registeredUserPanel.setOutputMarkupId(true);
>>        registeredUserPanel.setVisible(false);
>>
>> add(new AjaxLink("registerLink") {
>>
>>            @Override
>>            public void onClick(AjaxRequestTarget target) {
>>                registeredUserPanel.setVisible(true);
>>                target.addComponent(registeredUserPanel);
>>            }
>>        });
>>
>> the problem is that when I call registeredUserPanel.setVisible(false),
>> becuase by defualt I don't want this pannel to be visible; the wicket
>> don't
>> render the html markup for the pannel at all and hence the ajax calls
>> fails
>> becuase it don't find the markup to render the panel. Any suggestions how
>> to
>> tackle a situation like this.
>>
>> Regards,
>> RJ
>> --
>> View this message in context:
>> http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22103906.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104606.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Making an invisible panel visible via AjaxLink

Posted by Martijn Dashorst <ma...@gmail.com>.
http://tinyurl.com/dmhfub

On Thu, Feb 19, 2009 at 5:14 PM, rjilani <ji...@lifebiosystems.com> wrote:
>
> Hi: Gurus I am trying to make an invisible panel visible via Ajax link, but
> got stuck at a point where I don't know how to proceed further. Please see
> the code snipet below
>
> final RegisteredUserPanel registeredUserPanel = new
> RegisteredUserPanel("registrationPanel");
>
>        add(registeredUserPanel);
>        registeredUserPanel.setOutputMarkupId(true);
>        registeredUserPanel.setVisible(false);
>
> add(new AjaxLink("registerLink") {
>
>            @Override
>            public void onClick(AjaxRequestTarget target) {
>                registeredUserPanel.setVisible(true);
>                target.addComponent(registeredUserPanel);
>            }
>        });
>
> the problem is that when I call registeredUserPanel.setVisible(false),
> becuase by defualt I don't want this pannel to be visible; the wicket don't
> render the html markup for the pannel at all and hence the ajax calls fails
> becuase it don't find the markup to render the panel. Any suggestions how to
> tackle a situation like this.
>
> Regards,
> RJ
> --
> View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22103906.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: Making an invisible panel visible via AjaxLink

Posted by Michael Sparer <mi...@gmx.at>.
uff. yeah right :-)


igor.vaynberg wrote:
> 
> setoutputmarkupplaceholdertag that ernesto mentioned is the
> "non-trick" solution to your problem.
> 
> -igor
> 
> On Thu, Feb 19, 2009 at 8:39 AM, rjilani <ji...@lifebiosystems.com>
> wrote:
>>
>> Thanks Michael the trick worked like a charm.
>>
>> Best Regards,
>> RJ.
>>
>>
>> Michael Sparer wrote:
>>>
>>> put the panel in an additional container and add this container
>>>
>>> WebmarkupContainer div = new WebmarkupContainer("cont");
>>> div.setOutputMarkupId(true);
>>> div.add(registeredUserPanel.setVisible(false));
>>>
>>> then in the onclick stuff
>>> registeredUserPanel.setVisible(true);
>>> target.addComponent(div);
>>>
>>> that should do the trick
>>>
>>> hth,
>>> michael
>>>
>>>
>>> rjilani wrote:
>>>>
>>>> Hi: Gurus I am trying to make an invisible panel visible via Ajax link,
>>>> but got stuck at a point where I don't know how to proceed further.
>>>> Please see the code snipet below
>>>>
>>>> final RegisteredUserPanel registeredUserPanel = new
>>>> RegisteredUserPanel("registrationPanel");
>>>>
>>>>         add(registeredUserPanel);
>>>>         registeredUserPanel.setOutputMarkupId(true);
>>>>         registeredUserPanel.setVisible(false);
>>>>
>>>> add(new AjaxLink("registerLink") {
>>>>
>>>>             @Override
>>>>             public void onClick(AjaxRequestTarget target) {
>>>>                 registeredUserPanel.setVisible(true);
>>>>                 target.addComponent(registeredUserPanel);
>>>>             }
>>>>         });
>>>>
>>>> the problem is that when I call registeredUserPanel.setVisible(false),
>>>> becuase by defualt I don't want this pannel to be visible; the wicket
>>>> don't render the html markup for the pannel at all and hence the ajax
>>>> calls fails becuase it don't find the markup to render the panel. Any
>>>> suggestions how to tackle a situation like this.
>>>>
>>>> Regards,
>>>> RJ
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104436.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 


-----
Michael Sparer
http://techblog.molindo.at
-- 
View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104792.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Making an invisible panel visible via AjaxLink

Posted by Igor Vaynberg <ig...@gmail.com>.
setoutputmarkupplaceholdertag that ernesto mentioned is the
"non-trick" solution to your problem.

-igor

On Thu, Feb 19, 2009 at 8:39 AM, rjilani <ji...@lifebiosystems.com> wrote:
>
> Thanks Michael the trick worked like a charm.
>
> Best Regards,
> RJ.
>
>
> Michael Sparer wrote:
>>
>> put the panel in an additional container and add this container
>>
>> WebmarkupContainer div = new WebmarkupContainer("cont");
>> div.setOutputMarkupId(true);
>> div.add(registeredUserPanel.setVisible(false));
>>
>> then in the onclick stuff
>> registeredUserPanel.setVisible(true);
>> target.addComponent(div);
>>
>> that should do the trick
>>
>> hth,
>> michael
>>
>>
>> rjilani wrote:
>>>
>>> Hi: Gurus I am trying to make an invisible panel visible via Ajax link,
>>> but got stuck at a point where I don't know how to proceed further.
>>> Please see the code snipet below
>>>
>>> final RegisteredUserPanel registeredUserPanel = new
>>> RegisteredUserPanel("registrationPanel");
>>>
>>>         add(registeredUserPanel);
>>>         registeredUserPanel.setOutputMarkupId(true);
>>>         registeredUserPanel.setVisible(false);
>>>
>>> add(new AjaxLink("registerLink") {
>>>
>>>             @Override
>>>             public void onClick(AjaxRequestTarget target) {
>>>                 registeredUserPanel.setVisible(true);
>>>                 target.addComponent(registeredUserPanel);
>>>             }
>>>         });
>>>
>>> the problem is that when I call registeredUserPanel.setVisible(false),
>>> becuase by defualt I don't want this pannel to be visible; the wicket
>>> don't render the html markup for the pannel at all and hence the ajax
>>> calls fails becuase it don't find the markup to render the panel. Any
>>> suggestions how to tackle a situation like this.
>>>
>>> Regards,
>>> RJ
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104436.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Making an invisible panel visible via AjaxLink

Posted by rjilani <ji...@lifebiosystems.com>.
Thanks Michael the trick worked like a charm. 

Best Regards,
RJ.


Michael Sparer wrote:
> 
> put the panel in an additional container and add this container
> 
> WebmarkupContainer div = new WebmarkupContainer("cont");
> div.setOutputMarkupId(true);
> div.add(registeredUserPanel.setVisible(false));
> 
> then in the onclick stuff
> registeredUserPanel.setVisible(true);
> target.addComponent(div);
> 
> that should do the trick
> 
> hth,
> michael
> 
> 
> rjilani wrote:
>> 
>> Hi: Gurus I am trying to make an invisible panel visible via Ajax link,
>> but got stuck at a point where I don't know how to proceed further.
>> Please see the code snipet below
>> 
>> final RegisteredUserPanel registeredUserPanel = new
>> RegisteredUserPanel("registrationPanel");
>>         
>>         add(registeredUserPanel);
>>         registeredUserPanel.setOutputMarkupId(true);
>>         registeredUserPanel.setVisible(false);
>> 
>> add(new AjaxLink("registerLink") {
>> 
>>             @Override
>>             public void onClick(AjaxRequestTarget target) {
>>                 registeredUserPanel.setVisible(true);
>>                 target.addComponent(registeredUserPanel);
>>             }
>>         });
>> 
>> the problem is that when I call registeredUserPanel.setVisible(false),
>> becuase by defualt I don't want this pannel to be visible; the wicket
>> don't render the html markup for the pannel at all and hence the ajax
>> calls fails becuase it don't find the markup to render the panel. Any
>> suggestions how to tackle a situation like this.
>> 
>> Regards,
>> RJ
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104436.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Making an invisible panel visible via AjaxLink

Posted by Matt Welch <ma...@welchkin.net>.
The key, as others have alluded to and you discovered yourself, is that
setting a component's visibility to false will cause that component to not
be rendered. I know in the back of some people minds (mine included) we
think "invisible means it's there, we just can't see it). Well, in this case
invisible means it's not rendered at all. This is all just semantics until
you try to change that visibility on the client side (i.e. AJAX). Since it's
not there to being with, you can't really do client side modifications of
it. 

So, as Michael pointed out, you can instead put what you want to make
invisible inside a container and then use the Ajax functionality to update
that container and not the invisible item itself. The container will be
re-rendered and now that the internal item is set to "visible" it will be
rendered right along with its parent container.

Matt
----------------------


Michael Sparer wrote:
> 
> put the panel in an additional container and add this container
> 
> WebmarkupContainer div = new WebmarkupContainer("cont");
> div.setOutputMarkupId(true);
> div.add(registeredUserPanel.setVisible(false));
> 
> then in the onclick stuff
> registeredUserPanel.setVisible(true);
> target.addComponent(div);
> 
> that should do the trick
> 
> hth,
> michael
> 
> 
> rjilani wrote:
>> 
>> Hi: Gurus I am trying to make an invisible panel visible via Ajax link,
>> but got stuck at a point where I don't know how to proceed further.
>> Please see the code snipet below
>> 
>> final RegisteredUserPanel registeredUserPanel = new
>> RegisteredUserPanel("registrationPanel");
>>         
>>         add(registeredUserPanel);
>>         registeredUserPanel.setOutputMarkupId(true);
>>         registeredUserPanel.setVisible(false);
>> 
>> add(new AjaxLink("registerLink") {
>> 
>>             @Override
>>             public void onClick(AjaxRequestTarget target) {
>>                 registeredUserPanel.setVisible(true);
>>                 target.addComponent(registeredUserPanel);
>>             }
>>         });
>> 
>> the problem is that when I call registeredUserPanel.setVisible(false),
>> becuase by defualt I don't want this pannel to be visible; the wicket
>> don't render the html markup for the pannel at all and hence the ajax
>> calls fails becuase it don't find the markup to render the panel. Any
>> suggestions how to tackle a situation like this.
>> 
>> Regards,
>> RJ
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104664.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Making an invisible panel visible via AjaxLink

Posted by Michael Sparer <mi...@gmx.at>.
put the panel in an additional container and add this container

WebmarkupContainer div = new WebmarkupContainer("cont");
div.setOutputMarkupId(true);
div.add(registeredUserPanel.setVisible(false));

then in the onclick stuff
registeredUserPanel.setVisible(true);
target.addComponent(div);

that should do the trick

hth,
michael


rjilani wrote:
> 
> Hi: Gurus I am trying to make an invisible panel visible via Ajax link,
> but got stuck at a point where I don't know how to proceed further. Please
> see the code snipet below
> 
> final RegisteredUserPanel registeredUserPanel = new
> RegisteredUserPanel("registrationPanel");
>         
>         add(registeredUserPanel);
>         registeredUserPanel.setOutputMarkupId(true);
>         registeredUserPanel.setVisible(false);
> 
> add(new AjaxLink("registerLink") {
> 
>             @Override
>             public void onClick(AjaxRequestTarget target) {
>                 registeredUserPanel.setVisible(true);
>                 target.addComponent(registeredUserPanel);
>             }
>         });
> 
> the problem is that when I call registeredUserPanel.setVisible(false),
> becuase by defualt I don't want this pannel to be visible; the wicket
> don't render the html markup for the pannel at all and hence the ajax
> calls fails becuase it don't find the markup to render the panel. Any
> suggestions how to tackle a situation like this.
> 
> Regards,
> RJ
> 


-----
Michael Sparer
http://techblog.molindo.at
-- 
View this message in context: http://www.nabble.com/Making-an-invisible-panel-visible-via-AjaxLink-tp22103906p22104028.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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