On 8/13/07, Tauren Mills <[EMAIL PROTECTED]> wrote:
> My use case can best be described as making wicket-phonebook work
> within a single tab of a tabbed panel using AjaxLink for create, edit,
> and delete.
>
> Thus, I have a page that contains a TabbedPanel.
> One tab of TabbedPanel contains ContactListPanel.
> ContactListPanel contains createContact link and a DataTable
> DataTable contains rows of data with editContact and deleteContact links.
>
> Clicking on one of those links should replace ContactListPanel with
> ContactEditPanel or ContactDeletePanel.  I want the edit and delete
> functions to still be within the tabbed interface, not on separate
> pages.
>
> I think this is close, but am not sure what is wrong:
>
>         private void addCreateLink() {
>                 add(new AjaxLink("createLink") {
>                         @Override
>                         public void onClick(AjaxRequestTarget target) {
>                                 Panel panel = new ContactEditPanel("panel",
>                                                 new Model(new Contact()));
>                                 panel.setOutputMarkupId(true);
>                                 getParent().replaceWith(panel);
>                                 target.addComponent(panel);
>                         }
>                 });
>         }
> What is the proper way to replace the containing panel from a control
> within that panel? I found similar questions posted on this list, but
> I haven't got any of those solutions to work for me.

getParent.replace(panel) should work, or
ContactListPanel.this.replaceWith(panel). The difference is that
replaceWith replaces the component you call with the argument, and
replace replaces on of it's childs.

Btw, if you know which type of a containing parent you need (for
instance when you use a tagging interface) but not exactly where it
is, you can quite easily search for it by calling findParent.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to