Browse Source

automatically initialize selection in tagging mode. closes #19

Igor Vaynberg 13 years ago
parent
commit
19810405ce
1 changed files with 8 additions and 0 deletions
  1. 8 0
      select2.js

+ 8 - 0
select2.js

@@ -437,6 +437,14 @@
                 } else if ("tags" in opts) {
                     opts.query = tags(opts.tags);
                     opts.createSearchChoice = function (term) { return {id: term, text: term};}
+                    opts.initSelection = function (element) {
+                        var data = [];
+                        $(element.val().split(",")).each(function () {
+                            data.push({id: this, text: this});
+                        });
+                        return data;
+                    }
+
                 }
             }
         }