2012-03-12 46 views
1

我創建了包含2個文本框的列表視圖
&我想填補那些關於ajaxbutton提交。
但我得到這個錯誤:組件是一箇中繼器,不能通過ajax直接重新繪製

Component com.cerebrum.pages.ShowCalculator$ShowCalculatorForm$2 has been added to the target. This component is a repeater and cannot be repainted via ajax directly. Instead add its parent or another markup container higher in the hierarchy.

回答

8

你應該圍繞你的列表視圖與WebMarkupContainer和這個標記容器中,加入到請求目標。

的html代碼:

 
<div wicket:id="wmc"> 
    ... 
    put your list view here 
    ... 
</div> 

Java代碼

final WebMarkupContainer wmc = new WebMarkupContainer("wmc"); 
add(wmc); 
ListView yourListView = ... 
// init your list view here 
wmc.add(yourListView); 

SubmitButton yourButton = new SubmitButton("yourButton") { 
    @Override 
    public void onSubmit(AjaxRequestTarget target) { 
     target.add(wmc); 
    } 
} 
add(yourButton); 
+0

thanxxx很多.............精湛... – user1263633 2012-03-12 09:18:32

+0

但一個額外的問題是在這裏。 ... – user1263633 2012-03-12 09:18:55

+0

這個解決方案是超級的。我有一個Wicket模式面板,它包含dropdownchices和清爽的視圖。使用ddc的onselectionchanged方法使對話框關閉並使用onAjaxBehavior使刷新視圖無法更新。它只與mvc很好地配合。謝謝 – 2014-08-05 23:40:13

相關問題