[CLOSED] Problem with change event of comboboxes

  1. #1

    [CLOSED] Problem with change event of comboboxes

    I've noticed a strange bug with combobox and change event. To reproduce, please follow the steps below.

    1 - Select some value in the first combobox (with keyboard, type "a", then "enter" to select the value).
    2 - Press "tab" to leave the combobox.
    3 - Change event gets correctly fired, since the value was changed (i used an alert in the example to check if the event would be fired).
    4 - Close the alert window with "enter". The focus is set to the second combobox.
    5 - Press "shift + tab" to return to the first combobox.
    6 - Now wipe it's value with "backspace" and press "tab" two times: the first time, the value that was in the combobox before being wiped is selected, and the second time the control is left, the focus being set in the second combobox (loses it's focus). Since the value was not changed, change event is not fired, which is fine (the control was wiped, but since the least selected value was "forced" back, when control lost it's focus it still had the previous value).
    7 - Press "shift + tab" again to come back to the first combobox.
    8 - If you wipe the content of the combobox with backspace, unlike in the first time, the previous value is no longer "forced" back. It does get actually wiped.

    Now comes the problem:

    9 - When you press tab, the combobox loses it's focus, that is placed on the second combobox. But the change event is not fired. That's wrong, since the value actually changed: it had some value selected and now it's blank, so the change event should have been fired.


    <%@ Page Language="C#" AutoEventWireup="true" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script runat="server">
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
    
                s.DataSource = s2.DataSource = s3.DataSource = new List<Object>()
                {
                    new { Codigo = "A123" , Descricao = "A - 123"},
                    new { Codigo = "A456" , Descricao = "A - 456"},
                    new { Codigo = "A789" , Descricao = "A - 789"},
                    new { Codigo = "B123" , Descricao = "B - 123"},
                    new { Codigo = "B456" , Descricao = "B - 456"},
                    new { Codigo = "B789" , Descricao = "B - 789"}
                };
                s.DataBind();
                s2.DataBind();
                s3.DataBind();            
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <ext:ResourceManager runat="server" ID="rm1"></ext:ResourceManager>
                <ext:ComboBox runat="server" ID="c" 
                    Mode="Local"
                    Width="500" ValueField="Codigo" DisplayField="Descricao">
                    <Listeners>
                        <Change Handler="alert('changed!');" />
                    </Listeners>
                    <Store>
                        <ext:Store runat="server" ID="s">
                            <Reader>
                                <ext:JsonReader>
                                    <Fields>
                                        <ext:RecordField Name="Codigo"></ext:RecordField>
                                        <ext:RecordField Name="Descricao"></ext:RecordField>
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                </ext:ComboBox>
    
                            <ext:ComboBox runat="server" ID="c2" 
                    Mode="Local"
                    Width="500" ValueField="Codigo" DisplayField="Descricao">
                    <Listeners>
                        <Change Handler="alert('changed!');" />
                    </Listeners>
                    <Store>
                        <ext:Store runat="server" ID="s2">
                            <Reader>
                                <ext:JsonReader>
                                    <Fields>
                                        <ext:RecordField Name="Codigo"></ext:RecordField>
                                        <ext:RecordField Name="Descricao"></ext:RecordField>
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                </ext:ComboBox>
    
                            <ext:ComboBox runat="server" ID="c3" 
                    Mode="Local"
                    Width="500" ValueField="Codigo" DisplayField="Descricao">
                    <Listeners>
                        <Change Handler="alert('changed!');" />
                    </Listeners>
                    <Store>
                        <ext:Store runat="server" ID="s3">
                            <Reader>
                                <ext:JsonReader>
                                    <Fields>
                                        <ext:RecordField Name="Codigo"></ext:RecordField>
                                        <ext:RecordField Name="Descricao"></ext:RecordField>
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                </ext:ComboBox>
            </div>
        </form>
    </body>
    </html>
    Last edited by Daniil; Nov 06, 2014 at 1:29 PM. Reason: [CLOSED]
  2. #2
    Hi @josegarcia,

    8 - If you wipe the content of the combobox with backspace, unlike in the first time, the previous value is no longer "forced" back. It does get actually wiped.
    Maybe, I misunderstand something, but I seem cannot reproduce that. What to do after backspace? It clears the text. but the list is opened and the correct item is highlighted in that list. So, if press Tab (#9), the previous item is selected again and, respectively, no change. It is how that behaves for me. Though, I feel that something might be missed in #8 or, maybe, I misunderstand something.

    One more thing.
    6 - Now wipe it's value with "backspace" and press "tab" two times
    "two times" has been considered as a bug and fixed. Here is a related thread.
    http://forums.ext.net/showthread.php?45042

    Now the ComboBox blurs on first Tab press.

    By the way, could you, please, test your issue with the latest Ext.NET sources from SVN?
  3. #3
    Sorry Daniil, i've tried to reproduce the problem more times and it doesn't happen always, it's intermitent. I thought it would always happen the second time you clear the combo and leave it, but sometimes it happens in the first time, sometimes it doesn't happen at all. But following the example it will happen some times: just select some value, go to the next combo, come back to the first combo, wipe it with backspace and leave the combo again, all with the keyboard. Most times the when you wipe it and leave the combo the previous value will be forced back, but sometimes the value is actually wiped and change is still not fired.

    Don't know if it makes any difference, but i reproduced it under chrome.

    I'll try updating from SVN and let you know.
  4. #4
    Now I've tried in Chrome as well and, actually, tried many times - I cannot reproduce.

    I'll try updating from SVN and let you know.
    Thanks.
  5. #5
    After updating we tried many times to reproduce and thought it was solved. Just when i was about to post back to you to tell it happened again..
  6. #6
    I will try to reproduce again.

    I guess there is some important detail that we miss in the steps to reproduce. Maybe, the speed? The speed of pressing the keys.
  7. #7
    I still cannot reproduce...
  8. #8
    Fine. You may close this thread.. If i identify a pattern in order to reproduce i'll let you know. I'ts happening very rarely now.

Similar Threads

  1. [CLOSED] Editable grid Textbox Change Event Causing Problem
    By MarginPoint in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 06, 2014, 3:35 AM
  2. [CLOSED] Problem with capturing change event in multiselect box
    By taylorjp2000 in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Dec 20, 2013, 11:48 AM
  3. [CLOSED] linked comboboxes dynamic url problem
    By zwf in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Dec 13, 2012, 3:00 PM
  4. Problem with Linked ComboBoxes
    By csn in forum 1.x Help
    Replies: 3
    Last Post: Sep 24, 2010, 4:56 PM
  5. Comboboxes with same StoreID problem
    By vostro1700 in forum 1.x Help
    Replies: 2
    Last Post: Jul 31, 2009, 3:56 PM

Posting Permissions