Have a look at https://ci.apache.org/projects/wicket/guide/8.x/single.html#_working_with_ajax <https://ci.apache.org/projects/wicket/guide/8.x/single.html#_working_with_ajax>
François > Le 30 mai 2017 à 14:32, Sokab <[email protected]> a écrit : > > Hi. I follow this post > ( > https://stackoverflow.com/questions/24061261/loading-wicket-panels-dynamically-in-a-div > <https://stackoverflow.com/questions/24061261/loading-wicket-panels-dynamically-in-a-div> > > ) and try display necessary Panel inside layout but I really can't do it. > > I created a sample project: > > public class WicketApplication extends WebApplication{ > @Override > public Class<? extends WebPage> getHomePage() > { > return MainPage.class; > } > > @Override > protected void init() { > super.init(); > } > } > > *************************************************************************** > MainPage.html: > > <html xmlns:wicket="http://wicket.apache.org"> > <head> .... </head> > <body> > <div>Main Page</div> > <wicket:container wicket:id="panel1"></wicket:container> > > <wicket:child /> > > </body> > </html> > > > MainPage.java: > > public class MainPage extends WebPage{ > > @Override > protected void onInitialize() { > super.onInitialize(); > > add(new Panel1("panel1")); > } > } > > *************************************************************************** > Panel1.html: > <html xmlns:wicket="http://wicket.apache.org"> > > <wicket:panel> > <wicket:container wicket:id="panel2"></wicket:container> > </wicket:panel> > > </html> > > > Panel1.java: > public class Panel1 extends Panel{ > > public Panel1(String id) { > super(id); > } > > @Override > protected void onInitialize() { > super.onInitialize(); > > add(new Panel2("panel2")); > } > } > > *************************************************************************** > Panel2.html: > <html xmlns:wicket="http://wicket.apache.org"> > <wicket:panel> > > <div> > Page1 <#> > Page2 <#> > </div> > > </wicket:panel> > </html> > > > Panel2.java: > public class Panel2 extends Panel{ > > public Panel2(String id) { > super(id); > } > > @Override > protected void onInitialize() { > super.onInitialize(); > > > add(new AjaxLink("page3") { > @Override > public void onClick(AjaxRequestTarget target) { > // ?? > } > }); > > > add(new AjaxLink("page4") { > @Override > public void onClick(AjaxRequestTarget target) { > // ?? > } > }); > > } > } > > *************************************************************************** > Panel3.html: > <html xmlns:wicket="http://wicket.apache.org"> > <wicket:panel> > <div> > Panel 3 Content > </div> > </wicket:panel> > </html> > > Panel3.java: > public class Panel3 extends Panel{ > public Panel3(String id) { > super(id); > } > } > > *************************************************************************** > Panel4.html: > <html xmlns:wicket="http://wicket.apache.org"> > <wicket:panel> > <div> > Panel 4 Content > </div> > </wicket:panel> > </html> > > Panel4.java: > public class Panel4 extends Panel{ > public Panel4(String id) { > super(id); > } > } > ********************************************************************************** > After clicked on AjaxLink inside Panel2 I need display panel3 or panel4 in > MainPage without reload all page. How can I do this? Can I call > wicket:id="homePanel" from MainPage.html inside Panel2.java and and replace > panel3/panel4 after ajax request? Thank You for any hint. > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/How-reload-necessary-Panel-inside-common-layout-tp4677948.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
