-- corr
This commit is contained in:
@@ -184,14 +184,10 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
"click": this._textBoxClickHandler,
|
||||
"focus": this._textBoxFocusHandler,
|
||||
"blur": this._textBoxBlurHandler,
|
||||
"keypress": this._textBoxKeyPressHandler
|
||||
"keypress": this._textBoxKeyPressHandler,
|
||||
"keydown": this._textBoxKeyDownHandler
|
||||
}, this);
|
||||
|
||||
if (Sys.Browser.agent == Sys.Browser.InternetExplorer || Sys.Browser.agent === Sys.Browser.Safari
|
||||
|| Sys.Browser.agent === Sys.Browser.WebKit) {
|
||||
$addHandler(this.get_textBoxControl(), "keydown", this._textBoxKeyDownHandler);
|
||||
}
|
||||
|
||||
|
||||
$addHandlers(this.get_buttonControl(),
|
||||
{
|
||||
'click': this._buttonClickHandler,
|
||||
@@ -243,10 +239,6 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
// zero margins & padding (helps particularly in firefox)
|
||||
if (style.padding == '')
|
||||
style.padding = '0px';
|
||||
|
||||
// button is originally hidden to reduce screen flicker
|
||||
this._buttonControl.style.visibility = 'visible';
|
||||
|
||||
},
|
||||
initializeOptionList: function () {
|
||||
|
||||
@@ -259,7 +251,7 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
var optionListControl = this.get_optionListControl();
|
||||
|
||||
// force inline display on Safari by moving the list to the bottom of the form.
|
||||
if (Sys.Browser.agent === Sys.Browser.Safari || Sys.Browser.agent === Sys.Browser.WebKit) {
|
||||
if (Sys.Browser.agent === Sys.Browser.Safari) {
|
||||
//this.get_element().removeChild(optionListControl);
|
||||
var parentOfOptionList = optionListControl.parentNode;
|
||||
if (parentOfOptionList != null)
|
||||
@@ -499,7 +491,8 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
x = textBoxBounds.x - (listBounds.width - textBoxBounds.width);
|
||||
}
|
||||
|
||||
Sys.UI.DomElement.setLocation(optionListControl, x, y);
|
||||
if($common.getCurrentStyle(this.get_textBoxControl(), "position", "") == "absolute")
|
||||
Sys.UI.DomElement.setLocation(optionListControl, x, y);
|
||||
|
||||
// enforce default scroll
|
||||
this._ensureHighlightedIndex();
|
||||
@@ -960,9 +953,8 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
liElement.style.backgroundColor = 'Highlight';
|
||||
liElement.style.color = 'HighlightText';
|
||||
}
|
||||
else {
|
||||
liElement.className = this.get_listItemHoverCssClass;
|
||||
}
|
||||
else
|
||||
liElement.className = this.get_listItemHoverCssClass();
|
||||
}
|
||||
|
||||
// unselect previously highlighted item
|
||||
@@ -1090,7 +1082,8 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
if (this._highlightedIndex >= 0) {
|
||||
this.get_textBoxControl().value = this._optionListItems[this._highlightedIndex].text;
|
||||
this.set_selectedIndex(this._highlightedIndex);
|
||||
__doPostBack(this.get_element().id, '');
|
||||
if(this.get_autoPostBack())
|
||||
__doPostBack(this.get_element().id, '');
|
||||
}
|
||||
this._popupBehavior.hide();
|
||||
e.preventDefault();
|
||||
@@ -1240,33 +1233,6 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (Sys.Browser.agent == Sys.Browser.WebKit) {
|
||||
|
||||
// allow special funky apple webkit keypresses
|
||||
if (code == 8 // BACKSPACE in Safari 3
|
||||
|| code == 9 // TAB in Safari 3
|
||||
|| code == 19 // PAUSE BREAK Safari 3
|
||||
|| code == 33 // PAGEUP in Safari 3
|
||||
|| code == 34 // PAGEDOWN in Safari 3
|
||||
|| code == 35 // END in Safari 3
|
||||
|| code == 36 // HOME in Safari 3
|
||||
|| code == 37 // ARROWLEFT in Safari 3
|
||||
|| code == 39 // ARROWRIGHT in Safari 3
|
||||
|| code == 45 // INSERT in Safari 3
|
||||
|| code == 46 // DELETE in Safari 3
|
||||
|| code == 91 // WINDOWS LEFT Safari 3
|
||||
|| code == 92 // WINDOWS RIGHT Safari 3
|
||||
|| code == 93 // MENU Safari 3
|
||||
|| code == 113 // F2 Safari 3
|
||||
|| code == 115 // F4 Safari 3
|
||||
|| code == 118 // F7 Safari 3
|
||||
|| code == 119 // F8 Safari 3
|
||||
|| code == 120 // F9 Safari 3
|
||||
|| code == 122 // F11 Safari 3
|
||||
|| code == 145 // SCROLL LOCK Safari 3
|
||||
)
|
||||
return true;
|
||||
}
|
||||
else if (Sys.Browser.agent != Sys.Browser.InternetExplorer) {
|
||||
|
||||
// allow kepress events triggered by FF & Opera
|
||||
@@ -1472,7 +1438,7 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
}
|
||||
|
||||
// typedCharacter, textBoxValue, selectionPrefix, selectionSuffix, selectionTextFirst
|
||||
info.typedCharacter = String.fromCharCode(e.charCode);
|
||||
info.typedCharacter = String.fromCharCode(e.rawEvent.charCode || e.rawEvent.keyCode);
|
||||
info.textBoxValue = textBox.value;
|
||||
info.selectionPrefix = (info.textBoxValue.length >= info.selectionStart)
|
||||
? info.textBoxValue.substring(0, info.selectionStart)
|
||||
@@ -1744,10 +1710,17 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
return parseInt(selectedIndex);
|
||||
},
|
||||
set_selectedIndex: function (value) {
|
||||
if (this.get_hiddenFieldControl().value !== value.toString()) {
|
||||
if(this.get_hiddenFieldControl().value !== value.toString()) {
|
||||
var oldIndex = +this.get_hiddenFieldControl().value;
|
||||
|
||||
this.get_hiddenFieldControl().value = value.toString();
|
||||
this._ensureSelectedIndex();
|
||||
this.raisePropertyChanged('selectedIndex');
|
||||
|
||||
this.raise_selectedIndexChanged({
|
||||
oldIndex: oldIndex,
|
||||
newIndex: value
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1842,6 +1815,24 @@ Sys.Extended.UI.ComboBox.prototype = {
|
||||
this.raisePropertyChanged('listItemHoverCssClass');
|
||||
}
|
||||
},
|
||||
|
||||
/// <summary>
|
||||
/// An event handler rised when selected index changed
|
||||
/// </summary>
|
||||
/// <member name="cE:AjaxControlToolkit.ComboBox.selectedIndexChanged" />
|
||||
/// <event add="add_selectedIndexChanged" remove="remove_selectedIndexChanged" raise="raise_selectedIndexChanged" />
|
||||
add_selectedIndexChanged: function(handler) {
|
||||
this.get_events().addHandler("selectedIndexChanged", handler);
|
||||
},
|
||||
remove_selectedIndexChanged: function(handler) {
|
||||
this.get_events().removeHandler("selectedIndexChanged", handler);
|
||||
},
|
||||
raise_selectedIndexChanged: function(eventArgs) {
|
||||
var handler = this.get_events().getHandler('selectedIndexChanged');
|
||||
if(handler) {
|
||||
handler(this, eventArgs);
|
||||
}
|
||||
}
|
||||
};
|
||||
Sys.Extended.UI.ComboBox.registerClass('Sys.Extended.UI.ComboBox', Sys.UI.Control);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user