Dear all,
I have one ListView , inside need to add checkbox for users to select, only
can select one, how can i do? thanks a lot.
the following is the codes:
Java:
ListView fileListView = new ListView("fileList", files) {
@Override
protected void populateItem(final ListItem item) {
final FileObj fileObj = (FileObj) item.getModelObject();
if (fileObj.isMain()) {
setPhotoMainStatus(true);
photoMainStatus = true;
}
CheckBox chkPhotoMain = new CheckBox("chkPhotoMain", new
PropertyModel(getParent(), "photoMainStatus"));
chkPhotoMain.add(new
AjaxFormComponentUpdatingBehavior("onClick")
{
@Override
protected void onUpdate(AjaxRequestTarget target)
{
System.out.println("----------------in the
checkbox, fileObj.getId()" + fileObj.getId());
}
});
item.add(chkPhotoMain);
item.add(new AttributeModifier("class", true, new
AbstractReadOnlyModel() {
@Override
public Object getObject() {
return ((item.getIndex() % 2) == 1) ? "even" :
"odd";
}
}));
}
};
htmL;
<td width="100"><input type="checkbox" wicket:id="chkPhotoMain"/>main</td>
--
View this message in context:
http://www.nabble.com/help%3A-How-to-set-checkbox-with-single-check--tp19281898p19281898.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.