Announcement

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

    SelectItem setAddUnknownValues

    Hi Isomorphic,

    Is there a way for us to get the behaviour of setAddUnknownValues in the case when the selectItem has a specified optionDataSource?

    Thanks

    void com.smartgwt.client.widgets.form.fields.SelectItem.setAddUnknownValues(Boolean addUnknownValues)

    If this item's value is set (via setValue() or similar) to a value which is not present in the com.smartgwt.client.types.ValueMap, should the value be rejected.

    If set to false the setValue() call will have no effect if the value is not a valid option.

    If set to true the item's value will be updated to the new value, and the value will be added to the set of options displayed in the pick-list until the next call to setValueMap() or setValue().

    Exception: If the value is set to null but there is no null entry in the valueMap for this item, setting addUnknownValues to true will not cause a null option to show up at the top of the select item pickList. Whether an empty option is shown in the pickList is governed by allowEmptyValue instead.

    Note that this property has no effect if the selectItem has a specified optionDataSource. If setValue() is called on a databound SelectItem and the new value does not match any loaded options, the value will be accepted, but not added to the options displayed in the pickList. Also note that if a displayField exists, a fetch will be performed in an attempt to retrieve a valid display value, as described under FormItem.fetchMissingValues. If specified the FormItem.loadingDisplayValue will be displayed while the fetch is in progress, and then the real value (mapped to a display field value if a matching record was found) will be displayed when the fetch completes.

    Note : This is an advanced setting
    Parameters:addUnknownValues New addUnknownValues value. Default value is trueSee Also:Dependent Selects Example

    #2
    Hi Isomorphic,

    To be more clear, we are asking about the "...the value will be accepted, but not added to the options displayed in the pickList..." part.

    We understand the default behaviour, and rely on that behaviour elsewhere, however, we have a use case where multiple=true, where we would like to choose if those options should also appear in the pickList.

    Regards

    Comment


      #3
      Having a value which is not part of the optionDataSource dataset would have strange and unclear consequences, eg how is stored value to display value lookup supposed to work..

      If you have values that you want to be able to be set but not chosen from the pickList, the clearest thing might be to have the value available from the optionDataSource, but just avoid the user being able to see it in the pickList via setting pickListCriteria that eliminates it.

      Comment

      Working...
      X