Re: Wicket: DropDownChoice onChange open response page in right frame
In fact, pageURL returns nothing. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763p4660771.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket: DropDownChoice onChange open response page in right frame
Thanks both for your quick replies. What does top refer to? In my page, I have the following structure: Home.html http://wicket.apache.org";> Home.java public class Home extends WebPage { /** */ private static final long serialVersionUID = 1L; /** * Constructor */ public Home() { IRequestHandler topFrameHandler = new BookmarkablePageRequestHandler(new PageProvider( TopFrame.class)); ExampleFrame topFrame = new ExampleFrame("topFrame", topFrameHandler); add(topFrame); // TopFrame.class is all right, so I don’t bother with it. IRequestHandler bodyFrameHandler = new BookmarkablePageRequestHandler(new PageProvider( BodyFrame.class)); ExampleFrame bodyFrame = new ExampleFrame("bodyFrame", bodyFrameHandler); add(bodyFrame); } // BodyFrame.class contains the left and right frames I am concerned about. } BodyFrame.java public class BodyFrame extends WebPage { /** */ private static final long serialVersionUID = 1L; private final FrameTarget frameTarget = new FrameTarget(IntroPage.class); /** * Constructor */ public BodyFrame() { // create a new page instance, passing this 'master page' as an argument LeftFrame leftFrame = new LeftFrame(this); getSession().getPageManager().touchPage(leftFrame); // get the url to that page IRequestHandler leftFrameHandler = new RenderPageRequestHandler(new PageProvider(leftFrame)); // and create a simple component that modifies it's src attribute to // hold the url to that frame ExampleFrame leftFrameTag = new ExampleFrame("leftFrame", leftFrameHandler); add(leftFrameTag); ExampleFrame rightFrameTag = new ExampleFrame("rightFrame") { /** */ private static final long serialVersionUID = 1L; protected CharSequence getUrl() { return frameTarget.getUrl(); } }; add(rightFrameTag); } /** * Gets frameTarget. * * @return frameTarget */ public FrameTarget getFrameTarget() { return frameTarget; } /** * @see org.apache.wicket.Component#isVersioned() */ @Override public boolean isVersioned() { return false; } } BodyFrame.html http://wicket.apache.org";> I tried the code you provided, but it did not work. Here is the JS code I tried: // pass selected skill value on to graph page ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { PageParameters pageParameters = new PageParameters(); pageParameters.add("skill", selectedSkill); CharSequence pageURL = urlFor(TraineesView.class, pageParameters); target.appendJavaScript("window.frames['body'].frames['right'].location=" + pageURL + ";"); } }); Based on the code I provided, is this JS code supposed to work? I add this code inside LeftFrame.java/.html, and I want to reference the html of BodyFrame. Thanks again, Jeremie -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763p4660770.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Wicket: DropDownChoice onChange open response page in right frame
Thanks both for your quick replies. What does top refer to? In my page, I have the following structure: Home.html http://wicket.apache.org";> Home.java public class Home extends WebPage { /** */ private static final long serialVersionUID = 1L; /** * Constructor */ public Home() { IRequestHandler topFrameHandler = new BookmarkablePageRequestHandler(new PageProvider( TopFrame.class)); ExampleFrame topFrame = new ExampleFrame("topFrame", topFrameHandler); add(topFrame); // TopFrame.class is all right, so I don't bother with it. IRequestHandler bodyFrameHandler = new BookmarkablePageRequestHandler(new PageProvider( BodyFrame.class)); ExampleFrame bodyFrame = new ExampleFrame("bodyFrame", bodyFrameHandler); add(bodyFrame); } // BodyFrame.class contains the left and right frames I am concerned about. } BodyFrame.java public class BodyFrame extends WebPage { /** */ private static final long serialVersionUID = 1L; private final FrameTarget frameTarget = new FrameTarget(IntroPage.class); /** * Constructor */ public BodyFrame() { // create a new page instance, passing this 'master page' as an argument LeftFrame leftFrame = new LeftFrame(this); getSession().getPageManager().touchPage(leftFrame); // get the url to that page IRequestHandler leftFrameHandler = new RenderPageRequestHandler(new PageProvider(leftFrame)); // and create a simple component that modifies it's src attribute to // hold the url to that frame ExampleFrame leftFrameTag = new ExampleFrame("leftFrame", leftFrameHandler); add(leftFrameTag); ExampleFrame rightFrameTag = new ExampleFrame("rightFrame") { /** */ private static final long serialVersionUID = 1L; protected CharSequence getUrl() { return frameTarget.getUrl(); } }; add(rightFrameTag); } /** * Gets frameTarget. * * @return frameTarget */ public FrameTarget getFrameTarget() { return frameTarget; } /** * @see org.apache.wicket.Component#isVersioned() */ @Override public boolean isVersioned() { return false; } } BodyFrame.html http://wicket.apache.org";> I tried the code you provided, but it did not work. Here is the JS code I tried: // pass selected skill value on to graph page ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { PageParameters pageParameters = new PageParameters(); pageParameters.add("skill", selectedSkill); CharSequence pageURL = urlFor(TraineesView.class, pageParameters); target.appendJavaScript("window.frames['body'].frames['right'].location=" + pageURL + ";"); } }); Based on the code I provided, is this JS code supposed to work? I add this code inside LeftFrame.java/.html, and I want to reference the html of BodyFrame. Thanks again, Jeremie From: Jesse Long-2 [via Apache Wicket] [mailto:ml-node+s1842946n4660765...@n4.nabble.com] Sent: August 7, 2013 07:30 To: Jeremie Subject: Re: Wicket: DropDownChoice onChange open response page in right frame Hi Jeremie, You can use javascript: target.appendJavascript("top.frames['myframename'].location='" + urlFor(TraineeView.class,pageParamaters) + "';"); Cheers,
Re: Wicket: DropDownChoice onChange open response page in right frame
Hi Jeremie, You can use javascript: target.appendJavascript("top.frames['myframename'].location='" + urlFor(TraineeView.class,pageParamaters) + "';"); Cheers, Jesse On 07/08/2013 13:09, Jeremie wrote: Hello, In my research project, I need to create a combo box with a list of choices. I use AJAX and DropDownChoice to perform some action on selection change. My application is based on the frames example on Wicket's website: http://www.wicket-library.com/wicket-examples/frames/ When the user selects a choice in the combo box, I use PageParameters to pass in the value of the selected choice to another Java/Wicket class I created that will query values from a db based on the selected value and will create a Highcharts graph in the right frame (the main frame). At this point, when I change the combo box selection, the graph opens, but in the left frame (or left menu bar if you prefer) instead of the main body (right frame). With anchor tags, I can specify the HTML target attribute with the value "right" ( <#> ) and this ensures my response page opens in the right frame, but my dropdown choices are not links. Here is my code that calls the response page with the parameters (ddSkills is a DropDownChoice object): // pass selected skill value on to graph page ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { PageParameters pageParameters = new PageParameters(); pageParameters.add("skill", selectedSkill); setResponsePage(TraineesView.class, pageParameters); } }); My questions is: how can I tell Wicket I want the response page to open in a new tab, or in my case the right frame, using PageParameters, or any other way I might not have figured out? Is is feasible using the values of a combo box or should I try using RepeatingView or ListView to make my "options" links, in which case I could perhaps add the target attribute. Thanks for your help, Jeremie -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket: DropDownChoice onChange open response page in right frame
Hi, On Wed, Aug 7, 2013 at 1:09 PM, Jeremie wrote: > Hello, > > In my research project, I need to create a combo box with a list of > choices. > I use AJAX and DropDownChoice to perform some action on selection change. > My > application is based on the frames example on Wicket's website: > http://www.wicket-library.com/wicket-examples/frames/ > > When the user selects a choice in the combo box, I use PageParameters to > pass in the value of the selected choice to another Java/Wicket class I > created that will query values from a db based on the selected value and > will create a Highcharts graph in the right frame (the main frame). > > At this point, when I change the combo box selection, the graph opens, but > in the left frame (or left menu bar if you prefer) instead of the main body > (right frame). With anchor tags, I can specify the HTML target attribute > with the value "right" ( <#> ) and this ensures my response page opens > in the right frame, but my dropdown choices are not links. > > Here is my code that calls the response page with the parameters (ddSkills > is a DropDownChoice object): > > // pass selected skill value on to graph page > ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") > { > @Override > protected void onUpdate(AjaxRequestTarget target) { > PageParameters pageParameters = new PageParameters(); > pageParameters.add("skill", selectedSkill); > setResponsePage(TraineesView.class, pageParameters); > You can do this with some manually written JavaScript. Something like: CharSequence pageUrl = urlFor(TraineesView.class, pageParameters); target.appendJavaScript("frameReload('"+pageUrl+"')"); where frameReload is something like: function frameReload(url) { window.frames['right'].src = url; } I haven't used personally for maybe 8 years, so the above may be not fully correct. Why do you want to use ? Better use some CSS grid solution like http://getbootstrap.com/, http://ink.sapo.pt/ or http://foundation.zurb.com/ > } > }); > > My questions is: how can I tell Wicket I want the response page to open in > a > new tab, or in my case the right frame, using PageParameters, or any other > way I might not have figured out? Is is feasible using the values of a > combo > box or should I try using RepeatingView or ListView to make my "options" > links, in which case I could perhaps add the target attribute. > > Thanks for your help, > > Jeremie > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Wicket: DropDownChoice onChange open response page in right frame
Hello, In my research project, I need to create a combo box with a list of choices. I use AJAX and DropDownChoice to perform some action on selection change. My application is based on the frames example on Wicket's website: http://www.wicket-library.com/wicket-examples/frames/ When the user selects a choice in the combo box, I use PageParameters to pass in the value of the selected choice to another Java/Wicket class I created that will query values from a db based on the selected value and will create a Highcharts graph in the right frame (the main frame). At this point, when I change the combo box selection, the graph opens, but in the left frame (or left menu bar if you prefer) instead of the main body (right frame). With anchor tags, I can specify the HTML target attribute with the value "right" ( <#> ) and this ensures my response page opens in the right frame, but my dropdown choices are not links. Here is my code that calls the response page with the parameters (ddSkills is a DropDownChoice object): // pass selected skill value on to graph page ddSkills.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { PageParameters pageParameters = new PageParameters(); pageParameters.add("skill", selectedSkill); setResponsePage(TraineesView.class, pageParameters); } }); My questions is: how can I tell Wicket I want the response page to open in a new tab, or in my case the right frame, using PageParameters, or any other way I might not have figured out? Is is feasible using the values of a combo box or should I try using RepeatingView or ListView to make my "options" links, in which case I could perhaps add the target attribute. Thanks for your help, Jeremie -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-DropDownChoice-onChange-open-response-page-in-right-frame-tp4660763.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org