Editor Framework with DataGrid

99 views
Skip to first unread message

Qrunk

unread,
Jan 20, 2012, 8:24:39 AM1/20/12
to google-we...@googlegroups.com
Hi Thomas, 
I have a couple of questions on use of Editor Framework with DataGrid.

Code Snippet used :
Contacts.java
public Contacts() {
}



public List<Contact> getContactList() {
return contactList;
}

public void setContactList(List<Contact> contactList) {
this.contactList = contactList;
}

//this is for updating the name column
Column<Contact, String> nameColumn = new Column<Contact, String>(
new EditTextCell()) {
@Override
public String getValue(Contact object) {
return object.getName();
}
};
cellTable.addColumn(nameColumn, "Name");
nameColumn.setFieldUpdater(new FieldUpdater<Contact, String>() {

@Override
public void update(int index, Contact object, String value) {
object.setName(value);
// editor.getEditors().get(index).getValue().setName(value);
chosenContacts.refresh();
}
});

// on click of save button I call a save method

@UiHandler("save")
void onSaveClick(ClickEvent event) {
save();
}

public void save() {
Contacts contacts = driver.flush();// here is where I'm getting the exception
System.out.println(contacts.getContactList());
}


1. I have used HasDataEditor to populate the grid, that works fine , but when I try to print on console, the nested List<Contact> which is a property  with in the parent Model(Contacts), and by getting the updated model first by driver.flush() and print the nested list I get the following on console:


2.Do we have any way to reflect out editors(cell, which will be an editable cell, more precisely one EditTextCell) change made on UI, on the corresponding model property.

Thanks 
Reply all
Reply to author
Forward
0 new messages