You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ryan O'Hara <rj...@gmail.com> on 2009/09/16 21:30:57 UTC
Update parent component from child component
I'm trying to update a parent's, parent's, parent component using
AJAX. I tried combing the archives and came up with some seemingly
useful stuff (http://www.nabble.com/How-to-update-base-page-panel-from-child-page--td20998486.html#a21015568
), although I'm still have trouble. Below is a code snippet:
AjaxSubmitLink asl = new AjaxSubmitLink("submitButton") {
public void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(this.getParent().getParent().getParent());
}
};
'this' is an AjaxSubmitLink
1st getParent() is a Form
2nd getParent() is a Panel
3rd getParent() is a SecureWebPage
I'd like to reload SecureWebPage, so that all of its Panel child
components (and their child components) are reloaded. I've tried
explicitly calling setOutputMarkupId(true) on each Form, Panel, and
SecureWebPage component. I've also tried wrapping the Panels with a
WebMarkupContainer and updating that, but that didn't seem to work
either. Any advice?
Thanks,
Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Update parent component from child component
Posted by Jeremy Thomerson <je...@wickettraining.com>.
Well, one piece is to use findParent(SecureWebPage.class) rather than three
getParents.... or getPage()....
The question is why do you want to refresh the whole page via AJAX? Doesn't
that sort of defeat the purpose.
Nonetheless, please turn your application from deployment to development
mode and use the ajax debug to debug this.
--
Jeremy Thomerson
http://www.wickettraining.com
On Wed, Sep 16, 2009 at 2:30 PM, Ryan O'Hara <rj...@gmail.com> wrote:
> I'm trying to update a parent's, parent's, parent component using AJAX. I
> tried combing the archives and came up with some seemingly useful stuff (
> http://www.nabble.com/How-to-update-base-page-panel-from-child-page--td20998486.html#a21015568),
> although I'm still have trouble. Below is a code snippet:
>
> AjaxSubmitLink asl = new AjaxSubmitLink("submitButton") {
> public void onSubmit(AjaxRequestTarget target, Form form) {
>
> target.addComponent(this.getParent().getParent().getParent());
> }
> };
>
> 'this' is an AjaxSubmitLink
> 1st getParent() is a Form
> 2nd getParent() is a Panel
> 3rd getParent() is a SecureWebPage
>
> I'd like to reload SecureWebPage, so that all of its Panel child components
> (and their child components) are reloaded. I've tried explicitly calling
> setOutputMarkupId(true) on each Form, Panel, and SecureWebPage component.
> I've also tried wrapping the Panels with a WebMarkupContainer and updating
> that, but that didn't seem to work either. Any advice?
>
> Thanks,
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Update parent component from child component
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
I'm not sure you can reload a whole page using AJAX... Why not reload the
containing Panel? Mind that you have to make sure that the panel outputs a
markup ID so that AJAX replacement can work...
Ernesto
On Wed, Sep 16, 2009 at 9:30 PM, Ryan O'Hara <rj...@gmail.com> wrote:
> I'm trying to update a parent's, parent's, parent component using AJAX. I
> tried combing the archives and came up with some seemingly useful stuff (
> http://www.nabble.com/How-to-update-base-page-panel-from-child-page--td20998486.html#a21015568),
> although I'm still have trouble. Below is a code snippet:
>
> AjaxSubmitLink asl = new AjaxSubmitLink("submitButton") {
> public void onSubmit(AjaxRequestTarget target, Form form) {
>
> target.addComponent(this.getParent().getParent().getParent());
> }
> };
>
> 'this' is an AjaxSubmitLink
> 1st getParent() is a Form
> 2nd getParent() is a Panel
> 3rd getParent() is a SecureWebPage
>
> I'd like to reload SecureWebPage, so that all of its Panel child components
> (and their child components) are reloaded. I've tried explicitly calling
> setOutputMarkupId(true) on each Form, Panel, and SecureWebPage component.
> I've also tried wrapping the Panels with a WebMarkupContainer and updating
> that, but that didn't seem to work either. Any advice?
>
> Thanks,
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Update parent component from child component
Posted by Pedro Santos <pe...@gmail.com>.
See if it work, I don't think you are needing an asynchronous behavior to
your link...
setResponsePage(getPage());
On Wed, Sep 16, 2009 at 4:30 PM, Ryan O'Hara <rj...@gmail.com> wrote:
> I'm trying to update a parent's, parent's, parent component using AJAX. I
> tried combing the archives and came up with some seemingly useful stuff (
> http://www.nabble.com/How-to-update-base-page-panel-from-child-page--td20998486.html#a21015568),
> although I'm still have trouble. Below is a code snippet:
>
> AjaxSubmitLink asl = new AjaxSubmitLink("submitButton") {
> public void onSubmit(AjaxRequestTarget target, Form form) {
>
> target.addComponent(this.getParent().getParent().getParent());
> }
> };
>
> 'this' is an AjaxSubmitLink
> 1st getParent() is a Form
> 2nd getParent() is a Panel
> 3rd getParent() is a SecureWebPage
>
> I'd like to reload SecureWebPage, so that all of its Panel child components
> (and their child components) are reloaded. I've tried explicitly calling
> setOutputMarkupId(true) on each Form, Panel, and SecureWebPage component.
> I've also tried wrapping the Panels with a WebMarkupContainer and updating
> that, but that didn't seem to work either. Any advice?
>
> Thanks,
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>