From 1c989cfb09cb467af8a27a7ae72fc21f35d75275 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 23 May 2010 14:55:36 -0400 Subject: [PATCH] Allow an onAdd callback to be passed to the pretty ac. --- horde/js/prettyautocomplete.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.11.0