this.p.items = element;
this.p.trigger = element + 'real';
this.initialized = false;
+ this._enabled = true;
},
/**
- * Initialize the autocompleter, build the dom structure, register
+ * Initialize the autocompleter, build the dom structure, register
* events, etc...
*/
init: function()
{
+ if (this.initialized) {
+ return;
+ }
+
// Build the DOM structure
this.buildStructure();
*/
reset: function(existing)
{
+ if (!this.initialized) {
+ this.init();
+ }
+
// TODO: Resize the trigger field to fill the current line?
// Clear any existing values
if (this.selectedItems.length) {
this.addNewItemNode(existing[i]);
}
}
-
+ this._enabled = true;
},
buildStructure: function()
disable: function()
{
+ if (!this._enabled || !this.initialized) {
+ return;
+ }
+
this._enabled = false;
$(this.p.box).select('.hordeACItemRemove').each(function(e) {e.toggle()});
$(this.p.trigger).disable();
enable: function()
{
+ if (this._enabled) {
+ return;
+ }
this._enabled = true;
$(this.p.box).select('.hordeACItemRemove').each(function(e) {e.toggle()});
$(this.p.trigger).enable();