This is a migrated thread and some comments may be shown as answers.

.showDropDown() causes flicker vs. drop down staying open

3 Answers 128 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 11 Jun 2015, 02:33 PM

I have the following code setup in the onKeyPressing event of my RadComboBox.  When I execute it, if there are multiple results from the callback, the dropdown quickly opens and shuts (line 65 is where I open the combo box).  Based on my interpretation of the client side events, the combo box should remain open.  

I've also tried executing the .commitChanges() call before the .showDropDown() as well as attempted to event_args.setCancel(true), but neither worked. 

What am I missing?

01.function rrKeyPress(sender, eventArgs) {
02.    if (eventArgs.get_domEvent().keyCode == 13) {
03. 
04.        var clientId = sender.get_id();
05.        //var comboBox = document.getElementById(clientId);
06. 
07.        var comboBox = $find(clientId);
08.         
09.        var userEntry = comboBox._text;
10.        var matches = document.getElementById('txtNumEntries').value;
11. 
12.        var epmsDataHandler = '<%= ResolveUrl("~/EPMSDataHandler.ashx") %>';
13.        var randomNum = Math.round(+new Date() / 1000);
14. 
15.        var xhReq = new XMLHttpRequest();
16. 
17.        sURL = epmsDataHandler + "?userEntry=" + userEntry + "&matches=" + matches + "&randomNum=" + randomNum;
18. 
19.        xhReq.open("GET", sURL, false);
20.        xhReq.send(null);
21. 
22.        comboBox.clearItems();
23. 
24.        try {
25.            var response = xhReq.responseText;
26.            var fileError = 'ERRORMESSAGE';
27.            if (xhReq.responseText.substr(0, fileError.length) == fileError) {
28.                alert(xhReq.responseText.substr(fileError.length + 1, xhReq.responseText.length - fileError.length));
29.            }
30.            else {
31.                var jsonData = $.parseJSON(response);
32.                var numMatches = 0;
33.                var selectedItem = new Telerik.Web.UI.RadComboBoxItem();
34.                var firstDisplayName = "";
35. 
36.                for (var x = 0; x < jsonData.matches.length; x++) {
37.                    var match = jsonData.matches[x];
38. 
39.                    var comboItem = new Telerik.Web.UI.RadComboBoxItem();
40.                     
41.                    var displayName = match.fullName + " - " + match.id + " - " + match.rank;
42. 
43.                    if (x == 0)
44.                    {
45.                        firstDisplayName = displayName;
46.                    }
47. 
48.                    comboItem.set_value(match.id);
49.                    comboItem.set_text(displayName);
50. 
51.                    comboBox.get_items().add(comboItem);
52.                    numMatches++;
53.                    selectedItem == comboItem;
54.                }
55. 
56.                if (numMatches == 1)
57.                {                           
58.                    var item = comboBox.findItemByText(firstDisplayName);
59.                    if (item) {
60.                        item.select();
61.                    }
62.                }
63.                else
64.                {
65.                    comboBox.showDropDown();
66.                }
67. 
68.                document.getElementById('lblNumMatches').innerHTML = numMatches;
69. 
70.                comboBox.commitChanges();
71. 
72.            }
73.        }
74.        catch (ex) { alert("Error getting matching values - " + ex.message); return false; }
75.    }
76.}

3 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 11 Jun 2015, 02:52 PM

Forgot to include the combo box definition:

<telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientKeyPressing="rrKeyPress" MarkFirstMatch="True"></telerik:RadComboBox>

0
Matt
Top achievements
Rank 1
answered on 11 Jun 2015, 03:07 PM

Forgot to include the combo box definition:

<telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientKeyPressing="rrKeyPress" MarkFirstMatch="True"></telerik:RadComboBox>

0
Nencho
Telerik team
answered on 16 Jun 2015, 07:55 AM
Hello Matt,

I am afraid that I was unable to replicate the described issue, base on the provided code snippet. This is why, I would like to ask you to submit a support ticket, along with a simplified runnable sample attached so we could replicate the problem locally and suggest the proper solution.

Regards,
Nencho
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or