Combo select handler not fire if search text is number and only one result

  1. #1

    Combo select handler not fire when only one result

    Please try the sample, try these steps to reproduce:
    1. type prod and press button, then select any result, you will see two msg notified.
    2. type 100 and press button, then select the only one result, you won't see any msg.

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="System.Linq" %>
    <%@ Import Namespace="System.Net" %>
    
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
            }
        }
    
        [DirectMethod(ShowMask = true)]
        public void SearchWorkItem()
        {
            string strSearch = this.SearchBox.Text;
            int n;
            if ( int.TryParse(strSearch, out n) )
            {
                SearchStore.DataSource = new object[]
                {
                    new object[] { "100", "Prod1", "Alabama", "The Heart of Dixie" }
                };
            }
            else
            {
                SearchStore.DataSource = new object[]
                {
                    new object[] { "100", "Prod1", "Alabama", "The Heart of Dixie" },
                    new object[] { "101", "Prod2", "Alaska", "The Land of the Midnight Sun" },
                    new object[] { "102", "Prod3", "Arizona", "The Grand Canyon State" }
                };
            }
            SearchStore.DataBind();
        }
    
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <meta http-equiv="X-UA-Compatible" content="IE=100" />
        <script>
    
        </script>
    
    </head>
    <body>
    <form runat="server">
        <ext:ResourceManager runat="server" DirectMethodNamespace="MyCompany" >
        </ext:ResourceManager>
    
                                        <ext:Panel 
                                            runat="server" 
                                            Border="false" 
                                            Layout="Form" 
                                            ColumnWidth="0.3"
                                            LabelAlign="Top"
                                            >
                                            <Defaults>
                                                <ext:Parameter Name="MsgTarget" Value="side" />
                                            </Defaults>
                                            <Items>
                                        <ext:ComboBox
                                            ID="SearchBox"
                                            runat="server"
                                            Width="500"
                                            DisplayField="Title"
                                            ValueField="ID"
                                            FieldLabel="Serch WorkItem"
                                            AllowBlank="true"
                                            AutoLoad="false"
                                            PageSize="10"
                                            EmptyText="Input text and press button to search"
                                            QueryDelay="100000"
                                            >
                                            <Store>
                                                <ext:Store ID="SearchStore" runat="server" IsPagingStore="true" PageSize="10" >
                                                    <Model>
                                                        <ext:Model runat="server">
                                                            <Fields>
                                                                <ext:ModelField Name="ID" />
                                                                <ext:ModelField Name="Info" />
                                                                <ext:ModelField Name="AssignedTo" />
                                                                <ext:ModelField Name="Title" />
                                                            </Fields>
                                                        </ext:Model>
                                                    </Model>
                                                </ext:Store>
                                            </Store>
                                            <ListConfig Width="600" Height="300" ItemSelector=".x-boundlist-item">
                                                <Tpl runat="server">
                                                    <Html>
                                                        <tpl for=".">
                                                            <tpl if="[xindex] == 1">
                                                                <table class="cbStates-list">
                                                                    <tr>
                                                                        <th>ID</th>
                                                                        <th>WorkItem</th>
                                                                        <th>AssignedTo</th>
                                                                        <th>Title</th>
                                                                    </tr>
                                                            </tpl>
                                                            <tr class="x-boundlist-item">
                                                                <td>{ID}</td>
                                                                <td>{Info}</td>
                                                                <td>{AssignedTo}</td>
                                                                <td>{Title}</td>
                                                            </tr>
                                                            <tpl if="[xcount-xindex]==0">
                                                                </table>
                                                            </tpl>
                                                        </tpl>
                                                    </html>                </Tpl>
                                            </ListConfig>
                                            <Triggers>
                                                <ext:FieldTrigger Icon="Clear" Hidden="true" />
                                            </Triggers>
                                            <Listeners>
                                                <BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                <TriggerClick Handler="if (index == 0) {
                                                                           this.focus().clearValue();
                                                                           trigger.hide();
                                                                       }" />
                                                <Select Handler="this.getTrigger(0).show();
                                                                 Ext.Msg.notify('',#{SearchBox}.getValue());
                                                                 Ext.Msg.notify('',#{SearchBox}.getRawValue());
                                                                " />
                                            </Listeners>
                                            <RightButtons>
                                                <ext:Button ID="ButtonSearch" runat="server" Icon="Zoom" Handler="function () {#{DirectMethods}.SearchWorkItem();#{SearchBox}.onTriggerClick();}" />
                                            </RightButtons>
                                        </ext:ComboBox >
                                    </Items>
                                    </ext:Panel>
    
        </form>
    </body>
    </html>
    Last edited by rickywu; Jul 06, 2016 at 1:51 AM.
  2. #2
    Can any one help me?
  3. #3
    I think it's Ext JS but, because I solved by this:
    clear combobox text after return search result

Similar Threads

  1. Replies: 0
    Last Post: Oct 06, 2015, 3:56 PM
  2. [CLOSED] Panel Load handler doesn't fire in IE11
    By vadym.f in forum 3.x Legacy Premium Help
    Replies: 6
    Last Post: Sep 14, 2015, 12:48 PM
  3. [CLOSED] TagField : Remove.Handler not fire
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 29, 2014, 3:35 PM
  4. Replies: 3
    Last Post: Oct 15, 2013, 1:25 AM
  5. text search in combo box
    By Mr.Techno in forum 1.x Help
    Replies: 8
    Last Post: Dec 30, 2011, 5:14 AM

Posting Permissions