Rename init() to reset() and implement a new init() method that actually initializes...
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 10 Mar 2010 16:24:40 +0000 (11:24 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 10 Mar 2010 16:36:49 +0000 (11:36 -0500)
horde/js/prettyautocomplete.js

index d445a64..026c9aa 100644 (file)
@@ -28,7 +28,15 @@ var PrettyAutocompleter = Class.create({
             // the borderless input field located in p.box
             this.p.items = element;
             this.p.trigger = element + 'real';
+            this.initialized = false;
+        },
 
+        /**
+         * Initialize the autocompleter, build the dom structure, register 
+         * events, etc...
+         */
+        init: function()
+        {
             // Build the DOM structure
             this.buildStructure();
 
@@ -65,9 +73,15 @@ var PrettyAutocompleter = Class.create({
             if (typeof this.p.existing != 'undefined') {
                 this.init(this.p.existing);
             }
+
+            this.initialized = true;
         },
 
-        init: function(existing)
+        /**
+         * Reset the autocompleter's state
+         *
+         */
+        reset: function(existing)
         {
             // TODO: Resize the trigger field to fill the current line?
             // Clear any existing values