Author: pyaschenko
Date: 2010-09-01 07:06:10 -0400 (Wed, 01 Sep 2010)
New Revision: 19067
Modified:
branches/autocomplete/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
Log:
https://jira.jboss.org/browse/RF-8875
bug fixes
Modified:
branches/autocomplete/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js
===================================================================
---
branches/autocomplete/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-01
10:59:33 UTC (rev 19066)
+++
branches/autocomplete/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/Autocomplete.js 2010-09-01
11:06:10 UTC (rev 19067)
@@ -5,15 +5,17 @@
this.key = key.toLowerCase();
this.cache = {}
this.cache[this.key] = items || [];
- this.values = processValues(typeof values != "function" ? values ||
this.cache[this.key] : values(items));
+ this.originalValues = typeof values == "function" ? values(items) : values ||
this.cache[this.key];
+ this.values = processValues(this.originalValues);
this.useCache = useCache || checkValuesPrefix.call(this);
};
var processValues = function (values) {
+ var processedValues = [];
for (var i = 0; i<values.length; i++) {
- values[i] = values[i].toLowerCase();
+ processedValues.push(values[i].toLowerCase());
}
- return values;
+ return processedValues;
}
var checkValuesPrefix = function () {
@@ -59,7 +61,7 @@
};
var getItemValue = function (item) {
- return this.values[this.cache[this.key].index(item)];
+ return this.originalValues[this.cache[this.key].index(item)];
};
var isCached = function (key) {
@@ -275,7 +277,7 @@
var newItems = this.cache.getItems(value);
this.items = $(newItems);
//TODO: works only with simple markup, not with <tr>
- $(rf.getDomElement(this.id+ID.ITEMS)).empty().append();
+ $(rf.getDomElement(this.id+ID.ITEMS)).empty().append(this.items);
window.console && console.log &&
console.log("updateItemsFromCache");
};