Announcement

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

    SelectItem (addUnknownValues) not working.

    I am using SmartClient Power version 9.0.
    I have a SelectItem and use the following parameters:
    Code:
                        optionCriteria: cvarObjAdvancedCriteria,
                        optionDataSource: "datasource_name",
                        addUnknownValues: false,
    
    Note: var cvarObjAdvancedCriteria = {company_id: 2, status_cd: "Active"};
    The issue is that addUnknownValues does NOT work.
    The value in the field is NOT existing in the option list - and according to documentation the flag should add it to the option list?
    Is this a known issue?
    Please help.

    #2
    Hi guys
    Some answer here please?
    Tx

    Comment


      #3
      addUnknownValues:false means that any values not found in the valueMap/optionDataSource are rejected. It seems the behavior you want is the reverse of the setting you are using.

      Comment


        #4
        What I did is the following:

        1. Recap on the docs:
        http://www.smartclient.com/docs/9.0/a/b/c/go.html#attr..SelectItem.addUnknownValues

        2. Set the code to the following:
        {name: "c2", title: "T1 C2",
        _constructor: "SelectItem",
        width: 150,
        cellAlign: "left",
        showErrorStyle: true,
        optionDataSource: "t2",
        addUnknownValues: true
        },
        OK, so addUnknownValues is now set to true.

        3. The data for c2 is now set at "XXX". But the data source only return YYYY, ZZZZ.
        Now I expected XXX to be added to the oplion list of select item?

        It was not added.
        This happen irrespective the value of addUnknownValues params.

        Comment


          #5
          We've revisited this area and made a couple of changes to make things clearer. As of the next nightly build the behavior is as originally intended:

          The addUnknownValues attribute is actually not compatible with having an optionDataSource.
          If your options are coming from an option dataSource, and you (the developer) set the value to something which isn't present in the set of loaded options, the value is not rejected, but nor is it added to the set of options displayed in the pickList. This behavior is the same regardless of the addUnknownValues attribute value.

          We've also clarified the documentation to indicate this.
          SelectItem.addUnknownValues
          ----------------------------------

          If this item's value is set (via setValue or similar) to a value which is not present in the 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 update 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 SelectItem.allowEmptyValue instead.

          Note that this property has no effect if the selectItem has a specified SelectItem.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 SelectItem.displayField exists, a fetch will be performed in an attempt to retrieve a valid display value, as described under FormItem.fetchMissingValues.
          We apologize for any confusion here.

          Regards
          Isomorphic Software

          Comment

          Working...
          X