Announcement

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

    Detection of FormItem for SimpleType

    Hi,

    I can't find it in the docs, so I am not sure if this is inteded behaviour. It works that way in showcase.
    If you create SimpleType "price" and FormItem subclass "PriceItem", "PriceItem" is used as default control even if editorType is not set for new SimpleType.

    Code:
    isc.SimpleType.create({
        name: "price",
        inheritsFrom: "float",
    });
    
    isc.defineClass("PriceItem", "StaticTextItem")
    .addProperties({
        formatValue: function(value, record, form, item) {
          return 'I am a PriceItem!';
        }
    });
    
    isc.DynamicForm.create({
        ID: "form1",
        width: 620,
        colWidths: [190, "*"],
        fields: [
            {name: "Price", type: "price"},
        ],
    });
    If this is intended, please update docs at https://www.smartclient.com/smartcli.....FormItemType about details how the correct FormItem is selected.

    Also for "float" and "integer" this page in docs says that it will be the same as text while in fact it will be "FloatItem" and "TextItem".

    Best regards,
    Janusz

    #2
    The correct and documented way to cause a custom FormItem to be used for a SimpleType is to set simpleType.editorType. Please don't rely on the undocumented behavior you happen to have noticed; it exists for backwards compatibility and will eventually be removed.

    We'll clarify the docs around FloatItem / IntegerItem - they are trivial subclasses of TextItem that principally exist for SmartGWT, where we need a distinct type to make the Java APIs behave as Java programmers expect.

    Comment


      #3
      There should be a note somewhere about this strange behaviour needed for backward compatibilty.
      My intention was opposite - I wanted to keep using TextItem/FloatItem for this particular SimpleType, but was surprised when framework found PriceItem intended for use elsewhere (which caused some hard to track errors).

      Comment

      Working...
      X