AjaxFormComponentUpdatingBehavior
AjaxFormComponentUpdatingBehaviorを使うと、
画面で、テキストエリアやセレクター等に変更があった瞬間に画面上で
他のコンポーネントに変化をあたえたりできるのであります。
DropDownChoice typeChoice =
new DropDownChoice("type", new Model(), getTypeList(), selectableRender);
typeChoice.setRequired(true);
typeChoice.setOutputMarkupId(true);
AjaxFormComponentUpdatingBehavior onchange =
new AjaxFormComponentUpdatingBehavior("onchange"){
protected void onUpdate(AjaxRequestTarget ajaxRequestTarget){
typeList.add(typeChoice.getValue());
text.add(color_red);
ajaxRequestTarget.addComponent(text);
}
};
typeChoice.add(onchange);
add(typeChoice);
AjaxFormComponentUpdatingBehaviorのonUpdating( )内で、リストにコンポーネントのModelのvalueを格納したり、textの色を変えたりといろいろなことができるのであります。
counter: -
最終更新:2008年04月25日 19:40