I've made a grid with a single column containing a string, having based my code on http://www.sencha.com/examples/#Exam...needitablegrid. For some reason the model objects are never updated (i.e. a breakpoint in my setter never gets hit). What am I missing?
Code:
private ValueProperties props = GWT.create(ValueProperties.class);
public class Value {
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
interface ValueProperties extends PropertyAccess<Value> {
@Editor.Path("value")
ModelKeyProvider<Value> key();
ValueProvider<Value, String> value();
}
// widget setup
final ListStore<Value> store = new ListStore<Value>(props.key());
for (final String val : existingValues) {
final Value value = new Value();
value.setValue(val);
store.add(value);
}
final List<ColumnConfig<Value, ?>> cols = new LinkedList<ColumnConfig<Value, ?>>();
final ColumnConfig<Value, String> config = new ColumnConfig<Value, String>(props.value());
cols.add(config);
final ColumnModel<Value> model = new ColumnModel<Value>(cols);
final Grid grid = new Grid(store, model);
grid.setHideHeaders(true);
grid.setBorders(true);
editor = new GridInlineEditing(grid);
editor.addEditor(config, new TextField());
editor.setClicksToEdit(ClicksToEdit.ONE);
if (store.size() == 0) {
store.add(new Value());
}
editor.startEditing(new Grid.GridCell(0, 0));
editor.addCompleteEditHandler(new CompleteEditEvent.CompleteEditHandler() {
@Override
public void onCompleteEdit(CompleteEditEvent event) {
if (!Application.empty(store.get(store.size() - 1).getValue())) {
store.add(new Value());
}
}
});