this has to do with how wicket repaints things with ajax. what it does
is render the component and then replace the component's root dom node
in the existing markup with the one rendered via ajax.

lets take a simple example of attaching a listview to a [tr]

add(new ListView("rows", ...) { });

[table][tr wicket:id="rows"]...[/tr][/table]

suppose there are 3 items in the list

when rendered during initial request it looks like this

[table][tr][/tr][tr][/tr][tr][/tr][table]

now you say target.add(listview) to repaint it via ajax.

what will be rendered is this: [tr][/tr][tr][/tr][tr][/tr] but there
is no root dom node to replace...thus the problem

if you attach a webmarkup container to [table] and then repaint that
instead of the listview then the markup getting repainted is:
[table][tr][/tr][tr][/tr][tr][/tr][table] and that has the one
top-level tag you need to replace in markup.

you might argue that wicket should be smart and handle each [tr] separately.

what happens if elements change order? wicket would need to reorder
the nodes as well.

what happens if some elements in the list are no longer there? they
need to be somehow removed from the markup - but this information is
missing from the markup generated by re-rendering a repeater for ajax.
we cant just say : take the parent of the [tr] tag, clear all
children, add ones in ajax response. the reason we cannot is because
there may be two repeaters attached under the same parent node and you
may only be repainting one of them.

a possible solution would be to keep a list of previously rendered
repeater item ids in the repeater - that way we would know what to
nuke in the markup. but that would make the internals more
complicated.

adding a parent container and repainting that seems like a simple
solution to the problem.

-igor


On Tue, Apr 9, 2013 at 9:45 AM, Nick Pratt <nbpr...@gmail.com> wrote:
> I've never really understood this concept, and Im hoping that someone can
> explain:
>
> When I have a repeater, say a ListView, and I have the tags set up:
>
> <div wicket:id="myRepeater">
>  ...
>  whatever
>  ...
> </div>
>
> Why cant I repaint that component via Ajax? There's an ID etc.  - what in
> Wicket forces us to wrap that component in a (typically) WebMarkupContainer
> just to repaint the repeater?
>
> N

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

Reply via email to