From: Michael J. Rubinsky Date: Sun, 23 May 2010 18:55:36 +0000 (-0400) Subject: Allow an onAdd callback to be passed to the pretty ac. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1c989cfb09cb467af8a27a7ae72fc21f35d75275;p=horde.git Allow an onAdd callback to be passed to the pretty ac. --- diff --git a/horde/js/prettyautocomplete.js b/horde/js/prettyautocomplete.js index 38b5f5862..46ecd2a8f 100644 --- a/horde/js/prettyautocomplete.js +++ b/horde/js/prettyautocomplete.js @@ -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)