Announcement

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

    ComboBoxItem, DataArrivedHandler and defaultValue

    SmartClient Version: v9.1p_2014-06-04/Pro Deployment (built 2014-06-04)

    We have a ComboBoxItem with an optionDataSource/optionOperationId, for field "calendar" (see DS field below).

    A DataArrivedHandler handler is added to the ComboBoxItem.

    autoFetchData is FALSE.

    Code:
            <field name="calendar" foreignKey="calendar.id" canFilter="false" displayField="calendarName" type="text" defaultValue="1"></field>
    When clicking the picker icon, the fetch occurs and a DataArrivedEvent is fired for the ResultSet being populated.

    However, in the case where a fetch is made to get the displayName for the defaultValue of 1, a DataArrivedEvent does not seem to fire.

    1) We were expecting a DataArrivedEvent to be fired for the fetching of the defaultValue displayName.

    2) Is there a way to specify a defaultValue along with the defaultValue's display name to avoid this extra fetch to populate the missing display name for the default value?

    Thanks

    #2
    1. By design this does not happen. DataArrived is used to tell that the dataset needed for the PickList has arrived

    2. Specify a single-entry valueMap

    Comment


      #3
      Code:
      <field name="calendar" foreignKey="calendar.id" canFilter="false" displayField="calendarName" type="text" defaultValue="1">
          <valueMap>
              <value ID="1">Default</value>
          </valueMap>
      </field>
      I didn't use a single-entry valueMap because this seems to make the selection list static, in other words, clicking the picker icon no longer populates the list, I only ever see the default value as a selection.

      I've included the change I made above to try this, am I doing something wrong here?

      Thanks
      Last edited by stonebranch2; 13 Jun 2014, 10:07. Reason: Added back defaultValue attribute, as it is still required.

      Comment


        #4
        Here, you're relying on the optionDataSource being chosen automatically due to the foreignKey declaration. You'll need to explicitly add the optionDataSource in this case since your intent in adding a valueMap cannot be guessed by the framework.

        Note that presumably, in the actual application the valueMap will be added on the fly rather than statically defined in XML.

        Comment


          #5
          Yes, explicitly adding the optionDataSource was necessary. Thx

          "Note that presumably, in the actual application the valueMap will be added on the fly rather than statically defined in XML."

          > In the case where a new record is being created, we want the combo box to show "Default" (value 1) without doing a fetch for value 1's display name.
          Only if the user clicks the picker to select a different option, do we want a fetch to be done to re-populate the list with a full valueMap.

          ---

          "1. By design this does not happen. DataArrived is used to tell that the dataset needed for the PickList has arrived"

          >Is there any other handler that can be added for a display name fetch?

          Comment


            #6
            Is there any other handler that can be added for a display name fetch?
            No, no handler as such, although it can be detected because it would cause a ValueFormatter to be called if you had installed one.

            Beyond the ValueFormatter use case, what would you do with this information?

            Comment

            Working...
            X