Announcement

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

    SimpleType - editFormatter

    Version : SmartClient_v91p_2014-07-18_Pro

    We have created our own simpleType and added it some formattign rules by extending editFormatter, shortDisplayFormatter and normalDisplayFormatter (cf. MeiSimpleMoney in attachment).

    When we are in a ListGrid, the value is well formatted (our rules are applied), but when we open the item for edition (i.e. we create a dynamicForm to edit the value), we have a scripting error with this SmartClient version (with the version we used before - v9.0p_2014-01-24/Pro, we have no issue).

    In v9.1p, the method FloatItem.mapValueToDisplay has been changed
    Code:
    isc.FloatItem.addMethods({
    
        // Note: similar code appears in StaticTextItem
        mapValueToDisplay : function (value) {
            if (!this._inEditorMode) {
                var floatValue = null;
                if (isc.isA.String(value) && (this.type == null || !this.type.startsWith("locale"))) {
                    var parsedValue = window.parseFloat(value);
                    if (!window.isNaN(parsedValue) && parsedValue == value) {
                        floatValue = parsedValue;
                    }
                } else if (isc.isA.Number(value)) {
                    floatValue = value;
                }
                if (floatValue != null) {
                    if (this.format) {
                        return isc.NumberUtil.format(floatValue, this.format);
                    } else if (this._editFormatter != null) {
                        return this._editFormatter(floatValue, this);
                    } else if (this.decimalPrecision != null || this.decimalPad != null) {
                        return isc.Canvas.getFloatValueAsString(floatValue,
                            this.decimalPrecision, this.decimalPad);
                    } else if (this.precision != null) {
                        return isc.Canvas.getNumberValueAsString(floatValue,
                            this.precision, "float");
                    }
                }
            }
            return this.Super("mapValueToDisplay", arguments);
        },
    In the branch "if (floatValue != null)", the 2 first branch has been added. In our case, we reach the second branch ('else if (this._editFormatter != null)") and our function (MeiSimpleMoney.editFormatter) is called and then we have the scripting error. Refer to the callstack I added in attachment, it'll probably easier to understand.

    It seems weird that our method editFormatter is called when the line return this._editFormatter(floatValue, this); is executed.

    Any idea on this?

    Thanks for your help.
    Attached Files

    #2
    We've made a change to address this issue. Please try the next nightly build in the 9.1 branch, dated July 23 or above

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks !

      It solved our problem.

      Comment

      Working...
      X