You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kamiseq <ka...@gmail.com> on 2011/03/29 16:49:30 UTC

dynamic child in container

hi, I ve googled a bit but all I ve found are links about panels.

my problem is that I would like to create components (with corresponding
html markup) and then add those components dynamically on request to target
container, where child component could be other container that might be
dynamically modified.
what I read about panels is that you need always mark a placeholder for a
child component so there is no way to add more or less child when my logic
decides to do so.

is this possible in wicket? could someone point me to some materials about
it?

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: dynamic child in container

Posted by kamiseq <ka...@gmail.com>.
ok, but I thought that repeaters are only to repeat same component many
times. but I ll check that again

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: dynamic child in container

Posted by Pointbreak <po...@ml1.net>.
That's what I thought you meant (ajax). If you want to add a
dynamic number of components during normal page construction, you
should have a look at wicket repeaters, e.g. RepeatingView. There
are plenty examples for how to use those.

On Tue, 29 Mar 2011 17:28 +0200, "kamiseq" <ka...@gmail.com>
wrote:

  thanks,
  so I understand that it is only possible with AJAX calls.
  could I make a link callback that will add random number of
  components on each request?
  there will be no wicket:id for dynamic child and I could
  generate as many components as I want, right?
  I will try this anyway;]
  pozdrawiam
  Paweł Kamiński
  [1]kamiseq@gmail.com
  [2]pkaminski.prv@gmail.com
  ______________________

References

1. mailto:kamiseq@gmail.com
2. mailto:pkaminski.prv@gmail.com

Re: dynamic child in container

Posted by kamiseq <ka...@gmail.com>.
thanks,
so I understand that it is only possible with AJAX calls. could I make a
link callback that will add random number of components on each request?
there will be no wicket:id for dynamic child and I could generate as many
components as I want, right?

I will try this anyway;]

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: dynamic child in container

Posted by kamiseq <ka...@gmail.com>.
hi again,
so I really dont understand how to set hings up but I tried this yesterday
around midnight :] so please forgive me ...

let me explain again

I have simple webpage *DashboardPage* (1)

<body>
      <a wicket:id="edit"><wicket:message key=""></w:m></a>
</body>

then I created a panel with a form *UserFormPanel*(2)

<body>
      <wicket:panel>
            <div class="popup">
                  <form wicket:id="userData">
                        <input ...... />
                        <input type="submit" />
                  </form>
                  <a wicket:id="cancel">go back</a>
            </div>
      </wicket:panel>
</body>

in *DashboardPage* I created AjaxLink for *edit* and tried to add *
UserFormPanel* to requestTarget when link is clicked, but in turn wicket
refused that saying the component has no outputMarkupID set to true (but it
doesnt tell on which component I should set that property).
the other thing is that I need to assign some wicket:id to
*UserFormPanel*created in link callback. but this id does not
correspond to any id in
markup so I get (think I get:) an exception.

how to set components right?
I really cannot find anything on the web about this! is this so rare
situation in wicket world???

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

Re: dynamic child in container

Posted by Pointbreak <po...@ml1.net>.
This is definitely possible. The easy way is to do
ajaxRequestTarget.addComponent(theParentComponent); the drawback being
that tho whole parent component will be redrawn, including childs that
were already on the page. If that is not acceptable, you could use
javascript to first create a child component of your parent with the
markupId of your new child (using
ajaxRequestTarget.prependJavascript("your javascript code that adds an
empty div with correct id to the parent"), and let wicket render the
child component by doing
ajaxRequestTarget.addComponent(theChildComponent).

On Tue, 29 Mar 2011 16:49 +0200, "kamiseq" <ka...@gmail.com> wrote:
> hi, I ve googled a bit but all I ve found are links about panels.
> 
> my problem is that I would like to create components (with corresponding
> html markup) and then add those components dynamically on request to
> target
> container, where child component could be other container that might be
> dynamically modified.
> what I read about panels is that you need always mark a placeholder for a
> child component so there is no way to add more or less child when my
> logic
> decides to do so.
> 
> is this possible in wicket? could someone point me to some materials
> about
> it?
> 
> pozdrawiam
> Paweł Kamiński
> 
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org