On 8/23/07, Artur W. <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> I have a panel with AjaxLink. I want to replace this panel with another one
> when user clicks this link.
>
> TestPage.java:
> public class TestPage extends Page {
>
> public TestPage() {
> this(null);
> }
>
> public TestPage(PageParameters parameters) {
> super(parameters);
> add(new TestPanel("panel", "some param"));
> }
> }
>
> TestPanel.java:
> public class TestPanel extends Panel {
>
> public TestPanel(String id, String param) {
> super(id);
> setOutputMarkupId(true);
> AjaxLink link = new AjaxLink("link") {
> public void onClick(AjaxRequestTarget target) {
> TestPanel newOne = new
> TestPanel(TestPanel.this.getId(), "another
> param");
> target.addComponent(newOne);
> }
do:
TestPanel newOne = new TestPanel(TestPanel.this.getId(), "another param");
TestPanel.this.replaceWith(newOne); <------------
target.addComponent(newOne);
so that the hierarchy on the server side reflects the replacement.
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]