Announcement

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

    valueField and displayField in SelectItem

    I have a selectItem with valueField, displayField and optionDataSource definied. Because of lags in connection with server side, I observed that selectItem is shown first with value from valueField and after the fetch on optionDataSource is completed, the value from displayField is used. Sometimes user has to wait a few seconds and is confused.

    I found a FormItemValueFormatter object, which I can attach to my selectItem. But the signature of method
    Code:
    String formatValue(Object value,
                       Record record,
                       DynamicForm form,
                       FormItem item)
    is in my opinion insufficient.
    In this method, first I've got a value from valueField and, in second invocation, from displayField, which suits to the workflow described above. The thing is, I am not able to determine the value in formatValue method come from valueField or displayField.

    Can You provide any solution?

    #2
    What would you do in your formatter? The display value is still being fetched, so were you planning to just override and display blank?

    Comment


      #3
      I have to interchangeably determine the value in formatter comes from valueField or displayField.

      In case the value comes from valueField (displayField has not loaded yet) I would like to return a "loading..." message. After the fetch on optionDataSource is completed I return value from displayField.

      Comment


        #4
        You can use getSelectedRecord() != null to determine if the record containing the displayValue is available yet.

        Comment


          #5
          Ok, this is exactly what I mean. Thank You!

          Comment

          Working...
          X