Hi All,
For some reason, my checkbox doesn't bind to my model. I have a
DataView that contains the Check component, and in my button, onClick, I use
form.getModelObject(), but the objects doesn't get set. (Earlier than this, I
tried AjaxButton and the form.getModelObject() returns an array of boolean)
Is there something missing? Here's the scenario:
CompoundPropertyModel compoundPropertyModel = new
CompoundPropertyModel(detachableModel);
final Form myform = new Form("formId",compoundPropertyModel);
CheckGroup checkGroup = new
CheckGroup("checkGroup",compoundPropertyModel);
checkGroup.add(new CheckGroupSelector("groupSelector"));
SortableDataProvider dp = new SortableContactDataProvider();
DataView dataView = new DataView("contacts",dp) {
...
protected void populateItem(Item item) {
Contact contact = (Contact) item.getModelObject();
item.setModel(new CompoundPropertyModel(contact));
item.add(new Check("selected") );
}
};
checkGroup.add(dataView);
myForm.add(checkGroup);
IndicatingAjaxLink link = IndicatingAjaxLink("link") {
@SuppressWarnings("unchecked")
@Override
public void onClick(AjaxRequestTarget target) {
Collection<Contact> contactList =
(Collection<Contact>) form.getModelObject();
if(contactList != null && !contactList.isEmpty()) {
for(ContactWrapper contactWrapper: contactList)
{
System.out.println("contact selected: " +
contactList.isSelected() );
}
}
}'
myForm.add(link);
Thanks for the help! Any suggestions/comments will be greatly appreciated!
Best,
Wen Tong
--
The only constant in life is change.
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]