Allow an onAdd callback to be passed to the pretty ac.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 23 May 2010 18:55:36 +0000 (14:55 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 23 May 2010 18:55:36 +0000 (14:55 -0400)
horde/js/prettyautocomplete.js

index 38b5f58..46ecd2a 100644 (file)
@@ -17,7 +17,8 @@ var PrettyAutocompleter = Class.create({
             // Allow for a function that filters the display value
             // This function should *always* return escaped HTML
             displayFilter: function(t) { return t.escapeHTML() },
-            filterCallback: this._filterChoices.bind(this)
+            filterCallback: this._filterChoices.bind(this),
+            onAdd: Prototype.K
         }, params || {});
 
         // Array to hold the currently selected items to ease with removing
@@ -205,6 +206,8 @@ var PrettyAutocompleter = Class.create({
 
         // ...and keep the selectedItems array up to date.
         this.selectedItems.push({ rawValue: value, displayValue: displayValue });
+        this.p.onAdd(value);
+
     },
 
     removeItemNode: function(item)