Using smartgwt 2.4, the editor FormItemValueFormatter seems to only fire on load and not when the value is changed (through the spinner or typing). The FormItemValueParser fires all the time. Has anyone else come across this? Here's an example:
Code:
package mytest.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.smartgwt.client.data.Record; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.SpinnerItem; import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; /** * Entry point classes define <code>onModuleLoad()</code>. */ public class Testsgwt implements EntryPoint { /** * This is the entry point method. */ public void onModuleLoad() { final DynamicForm styleForm = new DynamicForm(); SpinnerItem spinner = new SpinnerItem(); spinner.setName("field"); spinner.setMin(0.0d); spinner.setStep(1.0d); spinner.setEditorValueFormatter(new FormItemValueFormatter (){ @Override public String formatValue(Object value, Record record, DynamicForm form, FormItem item) { if (value == null) {GWT.log("null formatting"); return null; } try {GWT.log("formatting"); Double val = new Double(value.toString()); Double valplusone = val + 1; return valplusone.toString(); } catch (Exception e) {GWT.log(e.getMessage()); return null; } } }); styleForm.setFields(spinner); styleForm.draw(); } }
Comment