Sha256: d90e193ba59f6f69f778bbc32d881373df8bbc05dbbdb73cf5fa235a781b1677

Contents?: true

Size: 1.09 KB

Versions: 73

Compression:

Stored size: 1.09 KB

Contents

define([
  'jquery'
], function ($) {
  function InitSelection (decorated, $element, options) {
    if (options.get('debug') && window.console && console.warn) {
      console.warn(
        'Select2: The `initSelection` option has been deprecated in favor' +
        ' of a custom data adapter that overrides the `current` method. ' +
        'This method is now called multiple times instead of a single ' +
        'time when the instance is initialized. Support will be removed ' +
        'for the `initSelection` option in future versions of Select2'
      );
    }

    this.initSelection = options.get('initSelection');
    this._isInitialized = false;

    decorated.call(this, $element, options);
  }

  InitSelection.prototype.current = function (decorated, callback) {
    var self = this;

    if (this._isInitialized) {
      decorated.call(this, callback);

      return;
    }

    this.initSelection.call(null, this.$element, function (data) {
      self._isInitialized = true;

      if (!$.isArray(data)) {
        data = [data];
      }

      callback(data);
    });
  };

  return InitSelection;
});

Version data entries

73 entries across 73 versions & 7 rubygems

Version Path
radius-rails-3.1.4 app/assets/components/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.14.2 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.14.1 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.14.0 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.13.4 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.13.3 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.13.2 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.13.1 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.13.0 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.7 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.12.0 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.6 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.5 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.4 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.3 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.2 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.1 vendor/select2/src/js/select2/compat/initSelection.js
card-mod-bootstrap-0.11.0 vendor/select2/src/js/select2/compat/initSelection.js
card-1.100.0 mod/bootstrap/vendor/select2/src/js/select2/compat/initSelection.js
card-1.99.6 mod/bootstrap/vendor/select2/src/js/select2/compat/initSelection.js