Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    how to custom the value of a form item

    is there an interface like listgrid to customize the form item value?
    i have a dynamic form. i bind it with a datasource. one field is integer. when i show the value, i would like to times 100.
    for instance, the value is 0.101, i would like to display it as 10.1.

    please help. many thanks


    i rewrite Integer item, but it does not work. the following is my code
    public class MyFormItem extends IntegerItem{

    public native Integer getValueAsInteger() /*-{
    var self = this.@com.smartgwt.client.core.DataClass::getJsObj()();
    var ret;
    if(self.setValue) {
    ret = self.getValue();
    } else {
    ret = self.value;
    }
    return @com.smartgwt.client.util.JSOHelper::toInteger(I)(ret) * 100;
    }-*/;

    public native Object getValue() /*-{
    var self = this.@com.smartgwt.client.core.DataClass::getJsObj()();
    var ret;
    if(self.setValue) {
    ret = self.getValue();
    } else {
    ret = self.value;
    }
    return $wnd.SmartGWT.convertToJavaType(ret) * 100;
    }-*/;
    }
    Last edited by xc_wang; 30 Dec 2011, 01:31.

    #2
    I would say that FormItem.setEditorValueFormatter() and setEditorValueParser() is the way to go.
    MichalG

    Comment


      #3
      thanks. i will try.

      Comment

      Working...
      X