Announcement

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

    12.0p FormItemType "datetime" missing?

    Hi Isomorphic

    these docs DateRangeItem.absoluteDateTimeItemConstructor mention:
    The FormItem class to create when allowRelativeDates is false, and the DateRangeItem's type is "datetime".
    so I assume, there must be a FormItemType "datetime", which is not the case.
    Is this an issue in the docs or is it missing here and might cause problems somewhere else?
    The corresponding SmartGWT docs are way longer, but also do not mention datetime.

    Or am I being completely wrong here and these are not related?

    Best regards
    Blama

    #2
    There is a DateTimeItem documented for both SmartClient and SmartGWT and in general you can use the string name of the class with APIs like setEditorType(). We know you Java developers like to have enums for everything, so we'll add a formal constant.

    Comment


      #3
      Hi Isomorphic,

      I'm using it like this now and it's working, but also here with setType() it is unclear what Strings are acceptable options, as as docs do not mention a reference list:

      The signature is public void setType(java.lang.String type)
      Perhaps public void setType(java.lang.String formItemType) or a link to FormItemType in the text would help.

      Working code:
      Code:
                      DateRangeItem createdAtDRI = new DateRangeItem(DatasourceFieldEnu2.V_REPORTING_FUNNEL__CREATED_AT.getValue(),
                              I18nEdited.creationDateRange());
      [B]createdAtDRI.setType("datetime");[/B]
                      createdAtDRI.setAllowRelativeDates(true);
      I'm happy with the chosen default editor here if it matches the type of the field, therefore I think that I should use setType() instead of setEditorType().
      As this is working I'm also wondering if the default type for DateRangeItem (and similar) shouldn't be determined by the underlying DataSource field type.
      So the question is: Why do I need the setType() call at all, if my field in the .ds.xml is already datetime (as compared to date only)?

      Best regards
      Blama

      Comment


        #4
        setType() sets data type and the editor is still automatically determined based on context. For example, setting a type of "date" implies a DateItem in a normal DynamicForm, but would mean a DateRangeItem in a SearchForm, and a MiniDateRangeItem in a FilterEditor.

        setEditorType() picks a particular class to use.

        Comment


          #5
          Hi Isomorphic,

          I was aiming at the difference between DataSource Types date/datetime and if widgets (may it be DateItem or DateRangeItem or MiniDateRangeItem) should automatically set the "also show time attribute", like DateItem.showPickerTimeItem (directly for DateItem or for the generated DateItem-autoChildren in case of DateRangeItem or MiniDateRangeItem).

          Best regards
          Blama

          Comment

          Working...
          X