From 3d19d119f29b5112109d1cd20aa5e78f321ac42a Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 5 Mar 2013 18:12:05 +0000 Subject: [PATCH] Remove change state --- hinter.js | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/hinter.js b/hinter.js index 68a5f1c..3d264cb 100644 --- a/hinter.js +++ b/hinter.js @@ -63,9 +63,6 @@ Destroy instance: hint.remove(); hint = null; - - Change multiselect item state: - hint.changeMultiItem(index, name, disabled, checked); */ // *** Constructor *** @@ -158,6 +155,7 @@ SimpleAutocomplete.prototype.replaceItems = function(items, append) if (!append) { this.hintLayer.scrollTop = 0; + this.selectedIndex = -1; this.items = []; if (!items || items.length == 0) { @@ -220,39 +218,12 @@ SimpleAutocomplete.prototype.remove = function() this.items = null; }; -// Check/uncheck/enable/disable/rename multiselect item -SimpleAutocomplete.prototype.changeMultiItem = function(index, name, disabled, checked) -{ - if (this.items && this.items[index] && this.multipleDelimiter) - { - var d = document.getElementById(this.id+'_item_'+index); - d.className = disabled ? 'hintDisabledItem' : 'hintItem'; - var c = d.children[0]; - if (name && name != this.items[index][0]) - { - d.removeChild(c); - d.innerHTML = name; - d.childNodes.length ? d.insertBefore(c, d.childNodes[0]) : d.appendChild(c); - this.items[index][0] = name; - } - c.checked = checked && true; - c.disabled = disabled && true; - this.items[index][2] = disabled; - if ((this.items[index][3] && true) != c.checked && !this.multipleListener) - { - this.items[index][3] = c.checked; - this.toggleValue(index); - this.curValue = this.input.value; - } - } -}; - // Create a drop-down list item, include checkbox if this.multipleDelimiter is true SimpleAutocomplete.prototype.makeItem = function(index, item) { var d = document.createElement('div'); d.id = this.id+'_item_'+index; - d.className = item[2] ? 'hintDisabledItem' : 'hintItem'; + d.className = item[2] ? 'hintDisabledItem' : (this.selectedIndex == index ? 'hintActiveItem' : 'hintItem'); d.title = item[1]; d.innerHTML = item[0]; if (this.multipleDelimiter)