Should a ValuesManager report isNewRecord()==true following a call to saveData? Seems like it should be smart enough to set that to false when it gets the key back in the response... Similarly, I was surprised to find that the operation type is not reset to update? If I'm not mistaken, DynamicForms behave this way.
e.g.,
Yields
If I remove references to the valuesManager and instead invoke corresponding methods on the form directly, I get what I expect:
(3.1.d 7/21/2012)
e.g.,
Code:
public void onModuleLoad() { VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); DataSource ds = DataSource.get("Order"); DynamicForm form = new DynamicForm(); form.setWidth(500); final ValuesManager vm = new ValuesManager(); vm.setDataSource(ds); form.setDataSource(ds); form.setValuesManager(vm); IButton save = new IButton("Save"); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { vm.saveData(new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { GWT.log("Has key: " + vm.getValueAsString("ORDERID")); GWT.log("New record: " + vm.isNewRecord().toString()); GWT.log("Operation Type: " + vm.getSaveOperationType().toString()); } }); } }); IButton state = new IButton("Log"); state.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { GWT.log("Has key: " + vm.getValueAsString("ORDERID")); GWT.log("New record: " + vm.isNewRecord().toString()); GWT.log("Operation Type: " + vm.getSaveOperationType().toString()); } }); layout.addMembers(form, save, state); vm.editNewRecord(); layout.draw();
Code:
Has key: 11 New record: true Operation Type: ADD
Code:
Has key: 12 New record: false Operation Type: UPDATE
Comment