OK I figured out what the problem is.
If you want to replace one fragment with another over AJAX, then they must
have the same "markupId"s.
Otherwise it won't work.
I solved the problem by making "orig" fragment "final".
And after repl.setOutputMarkupId(true); I added
repl.setMarkupId(orig.getMarkupId());

and then it works.

May be something for the WIKI.





Thomas Mäder wrote:
> 
> What's the stack trace?
> 
> On Thu, Jun 12, 2008 at 3:01 PM, vkbhaskar <[EMAIL PROTECTED]> wrote:
> 
>>
>> How do I replace a fragment with an AjaxLink ?
>>
>> I am trying something like this.
>>
>> Fragment orig = new Fragment("container","original",this);
>> orig.setOutputMarkupId(true);
>> add(orig);
>> add(new AjaxLink("link") {
>>    public void onClick(AjaxTarget target) {
>>       Fragment repl = new Fragment("container","replace",MyPage.this);
>>       repl.setOutputMarkupId(true);
>>       MyPage.this.replace(repl);
>>       target.add(repl);
>>    }
>> }
>> );
>>
>> But I am getting ArrayIndexOutofBoundsExceptions, when the link is
>> clicked.
>> --
>> View this message in context:
>> http://www.nabble.com/Replace-a-fragment-with-AjaxLink-tp17799454p17799454.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Replace-a-fragment-with-AjaxLink-tp17799454p17800094.html
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