You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lang <de...@telfort.nl> on 2012/06/27 21:03:42 UTC

Ajax hide/show does not work

I do not understand this. I made a panel that must be hidden on click or show
up on another
Hiding works the first time then never again. SHow never works
What do i wrong??
==============
<html>
<head>
    <title>Wicket Examples - upload</title>
    <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>

Test


# Show 1 <br/>
# Show 2 <br/>

<div wicket:id="panel1" style="background-color: green;">
Kijk eens naar Panel1
</div>

<div wicket:id="panel2" style="background-color: yellow;">
Je kijkt naar panel2
</div>

</body>
</html>
========
	final WebMarkupContainer panel1 = new WebMarkupContainer("panel1");
	private boolean toon1;
	
	public HidePage(){
		
		add(panel1);
		panel1.setVisible(false);
		panel1.setOutputMarkupId(true);
		
  		add(toon1());
	}
	private AjaxLink toon1() {		
		AjaxLink link1 = new AjaxLink("link1"){
			private static final long serialVersionUID = 1L;
			public void onClick(AjaxRequestTarget target) {
				System.out.println("link 1 "+!toon1);
				panel1.setVisible(true);
				target.add(panel1);
			}
		}; 		
		return link1;
	}
	private AjaxLink toon2() {		
		AjaxLink link2 = new AjaxLink("link2"){
			private static final long serialVersionUID = 1L;
			public void onClick(AjaxRequestTarget target) {
				System.out.println("link 2 "+!toon2);
				panel1.setVisible(false);
				target.add(panel1);
			}
		}; 		
		return link2;
	}
}

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Ajax-hide-show-does-not-work-tp4650267.html
Sent from the Users forum 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: Ajax hide/show does not work

Posted by lang <de...@telfort.nl>.
It works now, thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Ajax-hide-show-does-not-work-tp4650267p4650271.html
Sent from the Users forum 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: Ajax hide/show does not work

Posted by Andrea Del Bene <an...@gmail.com>.
Hi,

try setOutputMarkupPlaceholderTag instead of setOutputMarkupId.
> I do not understand this. I made a panel that must be hidden on click or show
> up on another
> Hiding works the first time then never again. SHow never works
> What do i wrong??
> ==============
> <html>
> <head>
>      <title>Wicket Examples - upload</title>
>      <link rel="stylesheet" type="text/css" href="style.css"/>
> </head>
> <body>
>
> Test
>
>
> # Show 1 <br/>
> # Show 2 <br/>
>
> <div wicket:id="panel1" style="background-color: green;">
> Kijk eens naar Panel1
> </div>
>
> <div wicket:id="panel2" style="background-color: yellow;">
> Je kijkt naar panel2
> </div>
>
> </body>
> </html>
> ========
> 	final WebMarkupContainer panel1 = new WebMarkupContainer("panel1");
> 	private boolean toon1;
> 	
> 	public HidePage(){
> 		
> 		add(panel1);
> 		panel1.setVisible(false);
> 		panel1.setOutputMarkupId(true);
> 		
>    		add(toon1());
> 	}
> 	private AjaxLink toon1() {		
> 		AjaxLink link1 = new AjaxLink("link1"){
> 			private static final long serialVersionUID = 1L;
> 			public void onClick(AjaxRequestTarget target) {
> 				System.out.println("link 1 "+!toon1);
> 				panel1.setVisible(true);
> 				target.add(panel1);
> 			}
> 		}; 		
> 		return link1;
> 	}
> 	private AjaxLink toon2() {		
> 		AjaxLink link2 = new AjaxLink("link2"){
> 			private static final long serialVersionUID = 1L;
> 			public void onClick(AjaxRequestTarget target) {
> 				System.out.println("link 2 "+!toon2);
> 				panel1.setVisible(false);
> 				target.add(panel1);
> 			}
> 		}; 		
> 		return link2;
> 	}
> }
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Ajax-hide-show-does-not-work-tp4650267.html
> Sent from the Users forum 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