src/selectivity.js
function(newValue, options) {
        options = options || {};

        newValue = this.validateValue(newValue);

        this._value = newValue;

        if (this.options.initSelection) {
            this.options.initSelection(
                newValue,
                function(data) {
                    if (this._value === newValue) {
                        this._data = this.validateData(data);

                        if (options.triggerChange !== false) {
                            this.triggerChange();
                        }
                    }
                }.bind(this)
            );
        } else {
            this._data = this.getDataForValue(newValue);

            if (options.triggerChange !== false) {
                this.triggerChange();
            }
        }
    }
function(newValue, options) {
        options = options || {};

        newValue = this.validateValue(newValue);

        this._value = newValue;

        if (this.options.initSelection) {
            this.options.initSelection(
                newValue,
                function(data) {
                    if (this._value === newValue) {
                        this._data = this.validateData(data);

                        if (options.triggerChange !== false) {
                            this.triggerChange();
                        }
                    }
                }.bind(this)
            );
        } else {
            this._data = this.getDataForValue(newValue);

            if (options.triggerChange !== false) {
                this.triggerChange();
            }
        }
    }
function ( newValue , options ) { options = options || { } ; newValue = this . validateValue ( newValue ) ; this . _value = newValue ; if ( this . options . initSelection ) { this . options . initSelection ( newValue , function ( data ) { if ( this . _value === newValue ) { this . _data = this . validateData ( data ) ; if ( options . triggerChange !== false ) { this . triggerChange ( ) ; } } } . bind ( this ) ) ; } else { this . _data = this . getDataForValue ( newValue ) ; if ( options . triggerChange !== false ) { this . triggerChange ( ) ; } } }
Sets the value of the selection.

The value of the selection only concerns the IDs of the selection items. If you are
interested in the IDs and the text labels, you should use the data() method.

Note that if neither the items option nor the initSelection option have been set, Selectivity
will have no way to determine what text labels should be used with the given IDs in which
case it will assume the text is equal to the ID. This is useful if you're working with tags,
or selecting e-mail addresses for instance, but may not always be what you want.

@param newValue New value to set. For a MultipleSelectivity instance the value must be an
array of IDs, for a SingleSelectivity instance the value must be a single ID
(a string or a number) or null to indicate no item is selected.
@param options Optional options object. May contain the following property:
triggerChange - Set to false to suppress the "change" event being triggered.
Note this will also cause the UI to not update automatically;
so you may want to call rerenderSelection() manually when
using this option.
Sets the value of the selection .