WebComboBox: Setting the text on editable comboboxes correctly sets the Index property and raises the Click event.
[GB.WEB.GUI] * BUG: WebComboBox: Setting the text on editable comboboxes correctly sets the Index property and raises the Click event.
This commit is contained in:
parent
2d1d307455
commit
6aaf3381d9
2 changed files with 31 additions and 9 deletions
|
@ -77,7 +77,7 @@ Public Sub _Render()
|
|||
Print "<div class=\"gw-combobox-arrow\">";
|
||||
Endif
|
||||
|
||||
Print "<select id=\""; Me.Name; "-select\" autocomplete=\"off\""; Me._GetUpdateWaitJS("onclick", "index", "this.selectedIndex");
|
||||
Print "<select id=\""; Me.Name; ":select\" autocomplete=\"off\""; Me._GetUpdateWaitJS("onclick", "index", "this.selectedIndex");
|
||||
If Not Me.Enabled Then Print " disabled";
|
||||
Print ">"
|
||||
|
||||
|
@ -91,7 +91,7 @@ Public Sub _Render()
|
|||
|
||||
If Not $bReadOnly Then
|
||||
Print "</div>";
|
||||
WebForm._AddJavascript("gw.resizeComboBox(" & JS(Me.Name) & ")")
|
||||
WebForm._AddJavascript("gw.combobox.resize(" & JS(Me.Name) & ")")
|
||||
Endif
|
||||
Print
|
||||
|
||||
|
@ -127,7 +127,8 @@ Private Sub Index_Write(Value As Integer)
|
|||
Endif
|
||||
Endif
|
||||
|
||||
Me.Refresh
|
||||
'Me.Refresh
|
||||
If Me._CanRefresh() Then WebForm._AddJavascript("gw.combobox.update(" & JS(Me.Name) & "," & CStr($iIndex) & If($bReadOnly, "", "," & JS($sText)) & ")")
|
||||
|
||||
Raise Click
|
||||
|
||||
|
@ -238,6 +239,8 @@ End
|
|||
|
||||
Private Sub Text_Write(Value As String)
|
||||
|
||||
Dim iIndex As Integer
|
||||
|
||||
If $bReadOnly Then
|
||||
|
||||
Index_Write($aList.Find(Value))
|
||||
|
@ -245,9 +248,17 @@ Private Sub Text_Write(Value As String)
|
|||
Else
|
||||
|
||||
If $sText = Value Then Return
|
||||
iIndex = $aList.Find(Value)
|
||||
|
||||
$sText = Value
|
||||
|
||||
If Me._CanRefresh() Then WebForm._AddJavascript("$(" & JS(Me.Name & ":entry") & ").value = " & JS($sText))
|
||||
If Me._CanRefresh() Then WebForm._AddJavascript("gw.combobox.update(" & JS(Me.Name) & "," & CStr(iIndex) & "," & JS($sText) & ")")
|
||||
'WebForm._AddJavascript("$(" & JS(Me.Name & ":entry") & ").value = " & JS($sText))
|
||||
|
||||
If iIndex <> $iIndex Then
|
||||
$iIndex = iIndex
|
||||
Raise Click
|
||||
Endif
|
||||
|
||||
Raise Change
|
||||
|
||||
|
|
|
@ -395,11 +395,6 @@ gw = {
|
|||
}
|
||||
},
|
||||
|
||||
resizeComboBox: function(id)
|
||||
{
|
||||
$(id + '-select').onmouseover = function() { $(id + '-select').style.width = $(id).offsetWidth + 'px'; }
|
||||
},
|
||||
|
||||
highlightMandatory: function(id)
|
||||
{
|
||||
var elt = $(id);
|
||||
|
@ -1476,6 +1471,22 @@ gw = {
|
|||
}
|
||||
},
|
||||
|
||||
combobox:
|
||||
{
|
||||
resize: function(id)
|
||||
{
|
||||
$(id + ':select').onmouseover = function() { $(id + ':select').style.width = $(id).offsetWidth + 'px'; }
|
||||
},
|
||||
|
||||
update: function(id, index, text)
|
||||
{
|
||||
if (text != undefined)
|
||||
$(id + ':entry').value = text;
|
||||
|
||||
$(id + ':select').selectedIndex = index;
|
||||
}
|
||||
},
|
||||
|
||||
listbox:
|
||||
{
|
||||
selectRange: function(id, start, end, checked)
|
||||
|
|
Loading…
Reference in a new issue