Author: eallen
Date: 2010-06-18 10:53:41 -0400 (Fri, 18 Jun 2010)
New Revision: 4037
Modified:
mgmt/newdata/cumin/resources/incrementalSearch.js
Log:
Fix incremental search dropdown width
Modified: mgmt/newdata/cumin/resources/incrementalSearch.js
===================================================================
--- mgmt/newdata/cumin/resources/incrementalSearch.js 2010-06-18 14:06:28 UTC (rev 4036)
+++ mgmt/newdata/cumin/resources/incrementalSearch.js 2010-06-18 14:53:41 UTC (rev 4037)
@@ -29,15 +29,16 @@
};
p.show = function(){
- for(var thisObject = this, s = thisObject.c.style, o = thisObject.input, x =
o.offsetLeft,
- y = o.offsetTop + o.offsetHeight; o = o.offsetParent; x += o.offsetLeft, y +=
o.offsetTop);
- s.left = x + "px", s.top = y + "px",
+ var i = $(this.input), s = $(this.c);
+ var iSize = i.getSize(), iPos = i.getPosition();
+ var sPos = iPos; sPos.y = iPos.y + iSize.y;
+ s.setPosition(sPos); s.setStyle('width', iSize.x);
+ var thisObject = this, s = thisObject.c.style;
thisObject.l.length ? (s.display = "block", !thisObject.visible
&& (thisObject._callEvent("onshow"), ++thisObject.visible),
thisObject.highlite(0)) : s.display = "none";
};
p.hide = function(){
var thisObject = this, d = document, s = (thisObject.c &&
thisObject.c.parentNode.removeChild(thisObject.c),
thisObject.c = d.body.appendChild(d.createElement("div"))).style;
- thisObject.c.style.width = thisObject.input.offsetWidth + "px";
thisObject.l = [], thisObject.i = -1, thisObject.c.className =
thisObject.className, s.position = "absolute", s.display = "none";
thisObject._old = null, thisObject.visible &&
(thisObject._callEvent("onhide"), --thisObject.visible);
};
@@ -77,6 +78,7 @@
};
p._fadeOut = function(){
var f = (f = function(){arguments.callee.x.hide();}, f.x = this, setTimeout(f,
200));
+ this.select();
};
p._handler = function(e){
var thisObject = this, t = e.type, k = e.key;
@@ -94,29 +96,13 @@
return thisObject[e] instanceof Function ? thisObject[e].apply(thisObject,
[].slice.call(arguments, 1)) : undefined;
};
}
-//-- Searches for multiple matches ----
-function Inc_CIAnywhere(o, search){
- if(search = search.toLowerCase()) {
- var ul = $(o.listObjectID);
- var list = ul.getElements("li");
- for(var i = -1, l = list.length; ++i < l;){
- /*searches all the matches of "search" and adds the indexes in an
array */
- for(var j = 0, indices = []; j =
list[i].firstChild.nodeValue.toLowerCase().indexOf(search, j) + 1;
- indices[indices.length] = j - 1);
- /*if any ocurrence was found, adds the item and pass the position of the
matches*/
- if(indices.length)
- o.add(list[i].firstChild.nodeValue, indices);
- }
- }
- o.show();
-}
function Inc_CIBeginning(o, search) {
if (search = search.toLowerCase()) {
- var ul = $(o.listObjectID);
- var list = ul.getElements("li");
- for(var i = -1, l = list.length; ++i < l;)
- if( list[i].firstChild.nodeValue.toLowerCase().indexOf(search) == 0)
- o.add(list[i].firstChild.nodeValue, 0);
+ var select = $(o.listObjectID);
+ for (var i = 0, l = select.options.length; i < l; ++i) {
+ if (select.options[i].text.toLowerCase().indexOf(search) == 0)
+ o.add(select.options[i].text, 0, select.options[i].value);
+ }
}
if ((o.l.length == 0) && (search.length > 0)) {
o.add("No Matches", -1);