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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> >  For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to