📄 ig_webcombo3_1.js
字号:
/*
Infragistics Web Combo Script
Version 5.1.20051.37
Copyright (c) 2001-2004 Infragistics, Inc. All Rights Reserved.
*/
var igcmbo_displaying;
var igcmbo_currentDropped;
// private - hides all dropdown select controls for the document.
var igcmbo_hidden=false;
function igcmbo_hideDropDowns(bHide) {
if(igcmbo_dropDowns == null)
return;
if(bHide)
{
if(igcmbo_hidden)
return;
igcmbo_hidden = true;
for (i=0; i<igcmbo_dropDowns.length;i++)
igcmbo_dropDowns[i].style.visibility='hidden';
}
else
{
for (i=0; i<igcmbo_dropDowns.length;i++)
{
igcmbo_dropDowns[i].style.visibility='visible';
}
igcmbo_hidden = false;
}
}
var wccounter=0;
function igcmbo_onmousedown(evnt,id) {
var oCombo = igcmbo_getComboById(id);
if(!oCombo || !oCombo.Loaded)
return;
var src = igcmbo_srcElement(evnt);
oCombo.highlightText();
if(oCombo.Editable && src.id == id + "_input") return;
ig_inCombo = true;
oCombo.Element.setAttribute("noOnBlur",true);
if(igcmbo_currentDropped != null && igcmbo_currentDropped != oCombo)
igcmbo_currentDropped.setDropDown(false);
if(oCombo.getDropDown() == true) {
oCombo.setDropDown(false);
igcmboObject = oCombo;
if(document.all)
setTimeout('igcmbo_focusEdit()', 10);
}
else {
igcmbo_swapImage(oCombo, 2);
oCombo.setDropDown(true);
}
window.setTimeout("igtbl_cancelNoOnBlurDD()",100);
}
var igcmboObject = null;
function igcmbo_focusEdit() {
igcmboObject.setFocusTop();
}
function igcmbo_onmouseup(evnt,id) {
var oCombo = igcmbo_getComboById(id);
if(!oCombo || !oCombo.Loaded)
return;
if(oCombo.Dropped == true) {
igcmbo_swapImage(oCombo, 1);
}
else {
}
}
function igcmbo_onmouseout(evnt,id) {
var oCombo = igcmbo_getComboById(id);
if(!oCombo || !oCombo.Loaded)
return;
if(oCombo.Dropped == true) {
igcmbo_swapImage(oCombo, 1);
}
else {
}
}
function igcmbo_swapImage(combo, imageNo) {
var img = igcmbo_getElementById(combo.ClientUniqueId + "_img");
if(imageNo == 1) img.src = combo.DropImage1;
else img.src = combo.DropImage2;
}
function igcmbo_ondblclick(evnt,id) {
var oCombo = igcmbo_getComboById(id);
if(!oCombo || !oCombo.Loaded)
return;
if(oCombo.getDropDown() == true) {
oCombo.setDropDown(false);
}
}
function igcmbo_onKeyDown(evnt) {
if(evnt.keyCode == 40) { // down arrow
}
}
// public - Retrieves the server-side unique id of the combo
function igcmbo_getUniqueId(comboName) {
var combo = igcmbo_comboState[comboName];
if(combo != null)
return combo.UniqueId;
return null;
}
function igcmbo_getElementById(id) {
if(document.all)
return document.all[id];
else
return document.getElementById(id);
}
// public - returns the combo object for the Item Id
function igcmbo_getComboById(itemId) {
var id = igcmbo_comboIdById(itemId);
return igcmbo_comboState[id];
}
// public - returns the combo object from an Item element
function igcmbo_getComboByItem(item) {
var id = igcmbo_comboIdById(item.id);
return igcmbo_comboState[id];
}
// public - returns the combo Name from an itemId
function igcmbo_comboIdById(itemId) {
var comboName = itemId;
var strArray = comboName.split("_");
return strArray[0];
}
function igcmbo_getLeftPos(e) {
x = e.offsetLeft;
if(e.style.position=="absolute")
return x;
tmpE = e.offsetParent;
while (tmpE != null) {
if(tmpE.style.overflowX && tmpE.style.overflowX!="visible" || tmpE.style.overflow && tmpE.style.overflow!="visible")
break;
if((tmpE.style.position!="relative") && (tmpE.style.position!="absolute"))
x += tmpE.offsetLeft;
tmpE = tmpE.offsetParent;
}
return x;
}
function igcmbo_getTopPos(e) {
y = e.offsetTop;
if(e.style.position=="absolute")
return y;
tmpE = e.offsetParent;
while (tmpE != null) {
if(tmpE.style.overflowY && tmpE.style.overflowY!="visible" || tmpE.style.overflow && tmpE.style.overflow!="visible")
break;
if((tmpE.style.position!="relative") && (tmpE.style.position!="absolute"))
y += tmpE.offsetTop;
tmpE = tmpE.offsetParent;
}
return y;
}
// Warning: Private functions for internal component usage only
// The functions in this section are not intended for general use and are not supported
// or documented.
// private - Fires an event to client-side script and then to the server is necessary
function igcmbo_fireEvent(id,eventObj,eventString){
var oCombo=igcmbo_comboState[id];
var result=false;
if(eventObj[0]!="")
result=eval(eventObj[0]+eventString);
if(oCombo.Loaded && result!=true && eventObj[1]==1 && !oCombo.CancelPostBack)
oCombo.NeedPostBack = true;
oCombo.CancelPostBack=false;
return result;
}
// private - Performed on page initialization
function igcmbo_initialize()
{
if(typeof(window.igcmbo_initialized)=="undefined")
{
if(typeof(ig_csom)=="undefined" || ig_csom==null)
return;
ig_csom.addEventListener(document, "mousedown", igcmbo_mouseDown, false);
ig_csom.addEventListener(document, "mouseup", igcmbo_mouseUp, false);
window.igcmbo_initialized=true;
ig_currentCombo = null;
}
}
var igcmbo_comboState=[];
var igcmbo_dropDowns;
// private - initializes the combo object on the client
function igcmbo_initCombo(comboId) {
var comboElement = igcmbo_getElementById(comboId+"_Main");
var oCombo = new igcmbo_combo(comboElement,eval("igcmbo_"+comboId+"_Props"));
igcmbo_comboState[comboId] = oCombo;
igcmbo_fireEvent(comboId,oCombo.Events.InitializeCombo,"(\""+comboId+"\");");
if(document.all != null && oCombo.HideDropDowns==true && igcmbo_dropDowns==null) {
igcmbo_dropDowns = document.all.tags("SELECT");
}
oCombo.Loaded = true;
return oCombo;
}
// private - constructor for the combo object
function igcmbo_combo(comboElement,comboProps)
{
igcmbo_initialize();
this.Id=comboElement.id;
this.Element=comboElement;
this.Type="WebCombo";
this.UniqueId=comboProps[0];
this.DropDownId=comboProps[1];
this.DropDownId=this.DropDownId.replace(":", "");
this.DropDownId=this.DropDownId.replace("_", "x")+ "_main";
this.DropImage1=comboProps[2];
this.DropImage2=comboProps[3];
this.ForeColor=comboProps[9];
this.BackColor=comboProps[10];
this.SelForeColor=comboProps[11];
this.SelBackColor=comboProps[12];
this.DataTextField=comboProps[13];
this.DataValueField=comboProps[15];
this.HideDropDowns=comboProps[17];
this.Editable=comboProps[18];
this.ClassName=comboProps[19];
this.Prompt=comboProps[20];
this.ComboTypeAhead=comboProps[22];
var uniqueId = igcmbo_getClientUniqueId(this.UniqueId);
this.ClientUniqueId = uniqueId;
this.Events= new igcmbo_events(eval("igcmbo_"+uniqueId+"_Events"));
this.ExpandEffects = new igcmbo_expandEffects(comboProps[4], comboProps[5], comboProps[6], comboProps[7], comboProps[8], comboProps[9]);
this.Loaded=false;
this.Dropped = false;
this.NeedPostBack=false;
this.CancelPostBack=false;
this.TopHoverStarted=false;
this.getDropDown = igcmbo_getDropDown;
this.setDropDown = igcmbo_setDropDown;
this.getDisplayValue = igcmbo_getDisplayValue;
this.setDisplayValue = igcmbo_setDisplayValue;
this.getDataValue = igcmbo_getDataValue;
this.setDataValue = igcmbo_setDataValue;
this.setWidth = igcmbo_setWidth;
this.getWidth = igcmbo_getWidth;
this.getSelectedIndex = igcmbo_getSelectedIndex;
this.setSelectedIndex = igcmbo_setSelectedIndex;
this.selectedIndex = comboProps[21];
this.setFocusTop = igcmbo_setFocusTop;
this.updateValue = igcmbo_updateValue;
this.updatePostField = igcmbo_updatePostField;
this.setSelectedRow = igcmbo_setSelectedRow;
this.grid = grid;
var grid = igtbl_getElementById(this.ClientUniqueId + "xGrid");
if(grid!=null)
grid.setAttribute("igComboId", this.ClientUniqueId);
grid = igtbl_getGridById(this.ClientUniqueId + "xGrid");
this.grid = grid;
this.getGrid = igcmbo_getGrid;
var innerctl;
innerctl = igcmbo_getElementById(this.ClientUniqueId + "_input");
this.displayValue = innerctl.value;
this.setWidth(this.Element.offsetWidth);
// begin - editor control support
igcmbo_getElementById(this.UniqueId).Object=this;
this.getVisible = igcmbo_getVisible;
this.setVisible = igcmbo_setVisible;
this.getValue = igcmbo_getValue;
this.setValue = igcmbo_setValue;
this.eventHandlers=new Object();
this.addEventListener=igcmbo_addEventListener;
this.removeEventListener=igcmbo_removeEventListener;
// end - editor control support
this.keyCount=0;
this.typeAheadTimeout=null;
this.highlightText=igcmbo_highlightText;
}
// public - sets the width of the WebCombo to the passed in value
function igcmbo_setWidth(width) {
var innerctl;
if(width==0)
return;
var border = 6;
if(document.all)
border = this.Element.offsetWidth - this.Element.clientWidth;
var image = igcmbo_getElementById(this.ClientUniqueId + "_img");
innerctl = igcmbo_getElementById(this.ClientUniqueId + "_input");
innerctl.style.width = width - image.offsetWidth - border > 0 ? width - image.offsetWidth - border : width - image.offsetWidth;
this.Element.style.width = width;
}
// public - returns the CSS width of the combo element.
function igcmbo_getWidth() {return this.Element.style.width;}
// private - event initialization for menu object
function igcmbo_expandEffects(duration, opacity, type, shadowColor, shadowWidth, delay){
this.Duration=duration;
this.Opacity=opacity;
this.Type=type;
this.ShadowColor=shadowColor;
this.ShadowWidth=shadowWidth;
this.Delay=delay;
}
// private - event initialization for combo object
function igcmbo_getDropDown(){return this.Dropped;}
// private - event initialization for combo object
function igcmbo_setDropDown(bDrop){
if(this.Element.style.display=="none")
return;
if(bDrop == true) {
if(this.Dropped == true)
return;
var grid = igcmbo_getElementById(this.ClientUniqueId + "_container");
var type=this.ExpandEffects.Type;
var duration=this.ExpandEffects.Duration;
duration = duration/1000;
var shadowWidth=this.ExpandEffects.ShadowWidth;
var opacity=this.ExpandEffects.Opacity;
var shadowColor=this.ExpandEffects.ShadowColor;
var cTop=igcmbo_getTopPos(this.Element);
grid.style.top=cTop+this.Element.offsetHeight;
grid.style.left=igcmbo_getLeftPos(this.Element);
if(igcmbo_fireEvent(this.ClientUniqueId,this.Events.BeforeDropDown,"(\""+this.ClientUniqueId+"\");")) {
return;
}
if(this.HideDropDowns) igcmbo_hideDropDowns(true);
if(document.all && this.ExpandEffects.Type!="NotSet")
{
var type=this.ExpandEffects.Type;
var duration=this.ExpandEffects.Duration;
duration = duration/1000;
var shadowWidth=this.ExpandEffects.ShadowWidth;
var opacity=this.ExpandEffects.Opacity;
var shadowColor=this.ExpandEffects.ShadowColor;
if(type != 'NotSet')
grid.style.filter = "progid:DXImageTransform.Microsoft."+type+"(duration="+duration+");"
if(shadowWidth > 0) {
var s = " progid:DXImageTransform.Microsoft.Shadow(Direction=135, Strength="+shadowWidth+",color='"+shadowColor+"')";
grid.style.filter += s;
}
if(opacity < 100)
grid.style.filter += " progid:DXImageTransform.Microsoft.Alpha(Opacity="+opacity+");"
try{
if(grid.filters[0] != null)
grid.filters[0].apply();
}catch(ex){}
}
grid.style.visibility = 'visible';
grid.style.display = "";
var tw=grid.offsetWidth;
var bw=document.body.clientWidth;
if(grid.offsetLeft+tw>bw+document.body.scrollLeft)
if(bw-tw+document.body.scrollLeft>0)
grid.style.left=bw-tw+document.body.scrollLeft;
else
grid.style.left=0;
var th=grid.offsetHeight;
var bh=document.body.clientHeight;
if(grid.offsetTop+th>bh+document.body.scrollTop && cTop-th>0)
grid.style.top=cTop-th;
try{
if(document.all && grid.filters[0]!=null)
grid.filters[0].play();
}catch(ex){}
var dropdowngrid = igcmbo_getElementById(this.ClientUniqueId + "xGrid_main");
if(document.all && dropdowngrid != null) {
if(this.webGrid)
this.webGrid.Element.setAttribute("noOnResize",true);
igtbl_activate(this.ClientUniqueId + "xGrid");
if(this.webGrid)
this.webGrid.Element.removeAttribute("noOnResize");
}
this.Element.style.backgroundColor='white';
this.Dropped = true;
if(this.grid.getActiveRow())
igtbl_scrollToView(this.grid.Id,this.grid.getActiveRow().Element);
igcmbo_currentDropped = this;
igcmbo_fireEvent(this.ClientUniqueId,this.Events.AfterDropDown,"(\""+this.ClientUniqueId+"\");");
this._internalDrop = true;
setTimeout(igcmbo_clearInternalDrop, 100);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -