Skip to content

Instantly share code, notes, and snippets.

@jabaraster
Created February 21, 2014 00:43
Show Gist options
  • Save jabaraster/9126628 to your computer and use it in GitHub Desktop.
Save jabaraster/9126628 to your computer and use it in GitHub Desktop.
Wicketでボタンを押したときにJavaScriptによる処理を挟む方法 ref: http://qiita.com/jabaraster/items/68119c48156ed0b84899
final IndicatingAjaxButton button = new IndicatingAjaxButton("deleter") {
@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes pAttributes) {
super.updateAjaxAttributes(pAttributes);
final AjaxCallListener ajaxCallListener = new AjaxCallListener();
ajaxCallListener.onPrecondition("return confirm('この操作は取り消せません!本当に削除してよろしいですか?');");
pAttributes.getAjaxCallListeners().add(ajaxCallListener);
}
@Override
protected void onSubmit(final AjaxRequestTarget pTarget, final Form<?> pForm) {
// サブミットしたときの処理
...
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment