does it do that in all browsers?

also call view.setreuseitems(true);

-igor



On 8/23/07, Artur W. <[EMAIL PROTECTED]> wrote:
>
>
>
> igor.vaynberg wrote:
> >
> > c.replacewith(a) is the same as c.getparent().replace(a)
> >
>
> I want to extend this example and replace the panel but inside the
> ListView.
> But I've found another problem.
>
> I did like you wrote but the panel isn't replaced. The new panel is being
> added at the top of the table.
> Why?
>
> The Page:
> public class TestPage extends MyPage {
>
>         private static final List&lt;String&gt; params = Arrays.asList(
> new
> String[] { "one", "two", "three", "four"} );
>
>         public TestPage(PageParameters parameters) {
>                 super(parameters);
>
>                 ListView view = new ListView("list", params) {
>                         protected void populateItem(ListItem item) {
>                                 String s = (String) item.getModelObject();
>                                 item.add(new TestPanel("panel", s));
>                         }
>                 };
>                 add(view);
>         }
> }
>
> &lt;wicket:extend&gt;
>     &lt;table&gt;
>         &lt;tr wicket:id="list"&gt;
>             &lt;span wicket:id="panel"&gt;[panel]&lt;/span&gt;
>         &lt;/tr&gt;
>     &lt;/table&gt;
> &lt;/wicket:extend&gt;
>
> The 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");
>                                 TestPanel.this.replaceWith(newOne);
>                                 target.addComponent(newOne);
>                         }
>                 };
>                 link.add(new Label("label0", "click"));
>                 add(link);
>                 add(new Label("label1", param.toUpperCase()));
>                 add(new Label("label2", param.toLowerCase()));
>         }
>
> &lt;wicket:panel&gt;
>     &lt;td&gt;&lt;a href="#" wicket:id="link"&gt;&lt;span
> wicket:id="label0"&gt;["label0"]&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
>     &lt;td&gt;&lt;span
> wicket:id="label1"&gt;[label1]&lt;/span&gt;&lt;/td&gt;
>     &lt;td&gt;&lt;span
> wicket:id="label2"&gt;[label2]&lt;/span&gt;&lt;/td&gt;
> &lt;/wicket:panel&gt;
>
>
> Artur
> --
> View this message in context:
> http://www.nabble.com/Can-Panel-replace-itself---tf4318533.html#a12300076
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to