[FIXED] [#1618] [4.7.1] Selectbox Expand event is not triggering on first selection

  1. #1

    [FIXED] [#1618] [4.7.1] Selectbox Expand event is not triggering on first selection

    Hi,

    The Expand event of Selectbox is NOT triggering the event on first click/selection, it's triggering on second click. Please see the sample code below and let us know what i missed or any suggestion?. For the ComboBox the same code is working fine and event is firing on first selection/click only.

    <%@ Page Language="C#" %>
    
    
    
    <!DOCTYPE html>
    
    
    <html>
    <head runat="server">
        <title>SelectBox - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
        <script type="text/javascript">
            function loadData()
            {
                alert('expand clicked');
                var myData = [
            ['3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'],
            ['Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am'],
            ['Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am'],
            ['American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am'],
            ['American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am'],
            ['AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am'],
            ['Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am'],
            ['Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am'],
            ['Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am'],
            ['E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am']
                ];
    
    
                App.SelectBox1.store.loadData(myData);
            }
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
    
            <h3>SelectBox</h3>
    
    
            <p>A Component similar to an HTML SELECT input. If you click and drag on the items list, no selection is made.</p>
    
    
            <ext:SelectBox
                ID="SelectBox1"
                runat="server"
                DisplayField="state"
                ValueField="abbr"
                EmptyText="Select a state...">
                <Listeners>
                    <Expand Handler="loadData();" Single="true" />
                </Listeners>
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="abbr" />
                                    <ext:ModelField Name="state" />
                                    <ext:ModelField Name="nick" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
            </ext:SelectBox>
        </form>
    </body>
    </html>
    Last edited by fabricio.murta; Feb 20, 2019 at 4:51 AM. Reason: no feedback from the user in 7+ days
  2. #2
    Hello, Can anyone give us the suggestions on this issue!!!
  3. #3
    Hello!

    Moving your thread just like the other. We'll post a follow-up soon.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Hello again, @iansriley!

    There's an issue with the component when it has no initial data bound, that the first time one tries to expand it, nothing other than focusing would happen.

    Here's three solutions for the issue for the time being:

    1: Fix from code behind

    Add this to your page's Page_Load() event:

    //SelectBox1.Set("lastQuery", "");
    Remember to wrap this code around !X.IsAjaxRequest and/or !IsPostBack.

    2: Give the store an initial, blank data on load

    Just like the originating example, but you may, perhaps, give the entry an empty value:

    this.SelectBox1.GetStore().DataSource = new object[]
    {
        new object[] { "", "", "" }
    };
    You'd want to wrap this to avoid ajax/postback calls like solution 1 too.

    3: Solution 1 via markup

    As this setting is private from ExtJS code, it is not exposed to Ext.NET API. So you won't get auto-completion for it, but you'll be able to just enter it in markup. Code behind won't allow you to point at it directly at all. But you can hard-wire it using the CustomConfig block within the <ext:SelectBox> definition block:

    <CustomConfig>
        <ext:ConfigItem Name="lastQuery" Value="" />
    </CustomConfig>
    Similar approach to this would work for code behind as well. But as Ext.NET forwards unknown properties with lower camel casing to Javascript, you can just add LastQuery="" to the properties (next to ID="SelectBox1") and it should work just fine.

    Defect issue logged

    We've opened an issue on github to track and fix this problem next Ext.NET release. We've logged it under #1618 and will post an update here as soon as we get it fixed in Ext.NET sources.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello @iansriley!

    It's been a while since we posted a reply to this inquiry, yet no feedback from you. Do you still need assistance with this?

    If you don't post anything here in 7+ days from now, we may be marking the thread as closed and assume it no longer needs any attention. But we don't lock threads up, so you would still be able to post here whenever you feel like it.
    Fabrício Murta
    Developer & Support Expert
  6. #6
    It seems I treated this thread as a question/inquiry by mistake, and didn't bind an issue number and tags as it should have been.

    Anyways, the GitHub issue pointed to this so in the end we didn't really lost track of the issue, thanks to the GitHub report. Adjusting the thread now.
    Fabrício Murta
    Developer & Support Expert
  7. #7
    And we just fixed the issue now, the fix is going to make it to the next, 4.8.0, Ext.NET version!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Oct 19, 2018, 4:44 PM
  2. [CLOSED] SetValue call without triggering the Change event
    By registrator in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 13, 2015, 4:49 PM
  3. Replies: 5
    Last Post: May 23, 2013, 3:32 PM
  4. Replies: 2
    Last Post: Nov 02, 2011, 3:10 AM
  5. Button's onclick event is not triggering -
    By latif in forum 1.x Help
    Replies: 1
    Last Post: Nov 25, 2009, 12:25 PM

Tags for this Thread

Posting Permissions