Hi.
I want to select all Checkboxes in a CheckGroup with a Button.
Therefore I looked at CheckGroupSelector and came up with this:
public class CheckGroupButtonSelectAll extends Button
{
public CheckGroupButtonSelectAll(String id)
{
super(id);
setDefaultFormProcessing(false);
}
protected void onComponentTag(ComponentTag tag)
{
checkComponentTag(tag, "input");
CheckGroup group = (CheckGroup) findParent(CheckGroup.class);
tag.put("onclick", "var cb=this.form['" + group.getInputName()
+ "']; if (cb!=null) { if (!isNaN(cb.length)) { for(var
i=0;i<cb.length;i++) { cb[i].checked=true; } } }");
super.onComponentTag(tag);
}
}
The Problem: All Checkboxes get selected after click on the Button, but
right after that the DataTable refreshes and the selections are lost again.
I also tried to extend from AjaxButton and append the javascript in the
onSubmit, but then i can't use this.form['" + group.getInputName() + "']
to iterate over all checkboxes.
Any idea?
--
View this message in context:
http://www.nabble.com/Select-CheckGroup-with-Button-instead-of-CheckGroupSelector-tp15039121p15039121.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]