Commits

Mark Lavin  committed f80091a

Pass selectable options from data attribute when initializing the plugin. Thanks to @chronossc for the original idea/implementation.

  • Participants
  • Parent commits c5bde82
  • Branches plugin-refactor

Comments (0)

Files changed (1)

File selectable/static/selectable/js/jquery.dj.selectable.js

             /* Initialize a new selectable widget */
             var self = this,
             $input = $(this.element),
-            data = $input.data();
+            data = $input.data(),
+            options;
             this.url = data.selectableUrl || data['selectable-url'];
             this.allowNew = data.selectableAllowNew || data['selectable-allow-new'];
             this.allowMultiple = data.selectableMultiple || data['selectable-multiple'];
                 $input.val("");
                 this._initDeck();
             }
+            options = data.selectableOptions || data['selectable-options'];
+            if (options) {
+                this._setOptions(options);
+            }
             // Call super-create
             // This could be replaced by this._super() with jQuery UI 1.9
             $.ui.autocomplete.prototype._create.call(this);