You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maurice Marrink <ma...@gmail.com> on 2008/03/25 15:26:37 UTC
Re: Ajax in popup update to parent page?
You can not share any component between 2 or more pages if you add a
component to one page it is removed from the other page.
What you should do instead is add a new instance of the component to
each page and let the components share the same model.
If you then update the model and let ajax repaint all components they
should show the same state.
Maurice
On Tue, Mar 25, 2008 at 3:42 PM, Casey McGuire <kc...@ruff.com> wrote:
> Am I even close to doing this correctly?
>
> I have two pages and one panel. A parent page and a popup page. Both
> pages contain the Panel. The popup page also contains a Form with an
> Ajax button. When I click this button, I want it to update the
> TimePanel on both pages.
>
> When the parent launches the popup, it passes parameters for the page
> "getNumericId" and "getCurrentVersionNumber" to the popup.
>
> Parent page
> has a TimePanel
> link that launches popup
>
> Popup page
> has a TimePanel
> Form
> AjaxButton
>
>
> Here is the code for the AjaxButton
>
> protected void onSubmit(AjaxRequestTarget target, Form form) {
> if(target != null) {
> target.addComponent(timePanel);
> ParentPage p = (ParentPage)getPage().getPageMap().
> get(page_id, version_id);
>
> target.addComponent(p.get("timePanel"));
> }
> }
>
>
> The TimePanel on the popup gets updated, the one on the parent does not.
> The Ajax Debug window shows
> ERROR: Component with id [[kc1]] a was not found while trying to...
>
> This is the correct component that needs to get updated on the parent
> and I did setOutputMarkupId(true) on it, but no luck.
>
> Is this the correct way to try and do this?
>
> Thanks,
> Casey
>
> ---------------------------------------------------------------------
> 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: Ajax in popup update to parent page?
Posted by Maurice Marrink <ma...@gmail.com>.
On Tue, Mar 25, 2008 at 3:31 PM, Johan Compagner <jc...@gmail.com> wrote:
> sharing the same model is also dangerous
>
Right, because of the duplicates you can get when the pages are
serialized and deserialized.
Thanks for pointing that out Johan.
Maurice
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Ajax in popup update to parent page?
Posted by Casey McGuire <kc...@ruff.com>.
Johan Compagner wrote:
> sharing the same model is also dangerous
>
> What you should do is in the onSubmit of the ajaxbutton in the second page
> get the first page (hold on to it somehow that doesn't matter)
>
> and then do
>
> page.getModel().setObject(x)
>
> johan
Thanks. Will give this a go.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Ajax in popup update to parent page?
Posted by Johan Compagner <jc...@gmail.com>.
sharing the same model is also dangerous
What you should do is in the onSubmit of the ajaxbutton in the second page
get the first page (hold on to it somehow that doesn't matter)
and then do
page.getModel().setObject(x)
johan
On Tue, Mar 25, 2008 at 3:26 PM, Maurice Marrink <ma...@gmail.com> wrote:
> You can not share any component between 2 or more pages if you add a
> component to one page it is removed from the other page.
> What you should do instead is add a new instance of the component to
> each page and let the components share the same model.
> If you then update the model and let ajax repaint all components they
> should show the same state.
>
> Maurice
>
> On Tue, Mar 25, 2008 at 3:42 PM, Casey McGuire <kc...@ruff.com> wrote:
> > Am I even close to doing this correctly?
> >
> > I have two pages and one panel. A parent page and a popup page. Both
> > pages contain the Panel. The popup page also contains a Form with an
> > Ajax button. When I click this button, I want it to update the
> > TimePanel on both pages.
> >
> > When the parent launches the popup, it passes parameters for the page
> > "getNumericId" and "getCurrentVersionNumber" to the popup.
> >
> > Parent page
> > has a TimePanel
> > link that launches popup
> >
> > Popup page
> > has a TimePanel
> > Form
> > AjaxButton
> >
> >
> > Here is the code for the AjaxButton
> >
> > protected void onSubmit(AjaxRequestTarget target, Form form) {
> > if(target != null) {
> > target.addComponent(timePanel);
> > ParentPage p = (ParentPage)getPage().getPageMap().
> > get(page_id, version_id);
> >
> > target.addComponent(p.get("timePanel"));
> > }
> > }
> >
> >
> > The TimePanel on the popup gets updated, the one on the parent does
> not.
> > The Ajax Debug window shows
> > ERROR: Component with id [[kc1]] a was not found while trying to...
> >
> > This is the correct component that needs to get updated on the parent
> > and I did setOutputMarkupId(true) on it, but no luck.
> >
> > Is this the correct way to try and do this?
> >
> > Thanks,
> > Casey
> >
> > ---------------------------------------------------------------------
> > 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
>
>