[FIXED] [#1443] [4.2.1] Error in BeforeQuery combobox

  1. #1

    [FIXED] [#1443] [4.2.1] Error in BeforeQuery combobox

    Hi,
    see following example, to search chars are in the string, in Ext.Net3.3 I used:
    <BeforeQuery Handler="var q = queryEvent.query; 
    							 queryEvent.query = new RegExp(q, 'i');
    							 queryEvent.query.length = q.length;" />
    When I write some chars it works fine, but after I press backspace, in Ext.Net 4.2, It appears an Javascript error.
    Thank you

    Jimmy

    <%@ Page Language="C#" %>
    
    
    <script runat="server">
        private object TestData
        {
            get
            {
                return new object[]
                {
                    new object[] { "AL", "Alabama", "The Heart of Dixie" },
                    new object[] { "AK", "Alaska", "The Land of the Midnight Sun" },
                    new object[] { "AZ", "Arizona", "The Grand Canyon State" },
                    new object[] { "AR", "Arkansas", "The Natural State" },
                    new object[] { "CA", "California", "The Golden State" },
                    new object[] { "CO", "Colorado", "The Mountain State" },
                    new object[] { "CT", "Connecticut", "The Constitution State" },
                    new object[] { "DE", "Delaware", "The First State" },
                    new object[] { "DC", "District of Columbia", "The Nation's Capital" },
                    new object[] { "FL", "Florida", "The Sunshine State" },
                    new object[] { "GA", "Georgia", "The Peach State" },
                    new object[] { "HI", "Hawaii", "The Aloha State" },
                    new object[] { "ID", "Idaho", "Famous Potatoes" },
                    new object[] { "IL", "Illinois", "The Prairie State" },
                    new object[] { "IN", "Indiana", "The Hospitality State" },
                    new object[] { "IA", "Iowa", "The Corn State" },
                    new object[] { "KS", "Kansas", "The Sunflower State" },
                    new object[] { "KY", "Kentucky", "The Bluegrass State" },
                    new object[] { "LA", "Louisiana", "The Bayou State" },
                    new object[] { "ME", "Maine", "The Pine Tree State" },
                    new object[] { "MD", "Maryland", "Chesapeake State" },
                    new object[] { "MA", "Massachusetts", "The Spirit of America" },
                    new object[] { "MI", "Michigan", "Great Lakes State" },
                    new object[] { "MN", "Minnesota", "North Star State" },
                    new object[] { "MS", "Mississippi", "Magnolia State" },
                    new object[] { "MO", "Missouri", "Show Me State" },
                    new object[] { "MT", "Montana", "Big Sky Country" },
                    new object[] { "NE", "Nebraska", "Beef State" },
                    new object[] { "NV", "Nevada", "Silver State" },
                    new object[] { "NH", "New Hampshire", "Granite State" },
                    new object[] { "NJ", "New Jersey", "Garden State" },
                    new object[] { "NM", "New Mexico", "Land of Enchantment" },
                    new object[] { "NY", "New York", "Empire State" },
                    new object[] { "NC", "North Carolina", "First in Freedom" },
                    new object[] { "ND", "North Dakota", "Peace Garden State" },
                    new object[] { "OH", "Ohio", "The Heart of it All" },
                    new object[] { "OK", "Oklahoma", "Oklahoma is OK" },
                    new object[] { "OR", "Oregon", "Pacific Wonderland" },
                    new object[] { "PA", "Pennsylvania", "Keystone State" },
                    new object[] { "RI", "Rhode Island", "Ocean State" },
                    new object[] { "SC", "South Carolina", "Nothing Could be Finer" },
                    new object[] { "SD", "South Dakota", "Great Faces, Great Places" },
                    new object[] { "TN", "Tennessee", "Volunteer State" },
                    new object[] { "TX", "Texas", "Lone Star State" },
                    new object[] { "UT", "Utah", "Salt Lake State" },
                    new object[] { "VT", "Vermont", "Green Mountain State" },
                    new object[] { "VA", "Virginia", "Mother of States" },
                    new object[] { "WA", "Washington", "Green Tree State" },
                    new object[] { "WV", "West Virginia", "Mountain State" },
                    new object[] { "WI", "Wisconsin", "America's Dairyland" },
                    new object[] { "WY", "Wyoming", "Like No Place on Earth" }
                };
            }
        }
    </script>
    
    
    <!DOCTYPE html>
    
    
    <html>
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
                <ext:ComboBox
                    runat="server"
                    FieldLabel="Select a single state"
                    DisplayField="name"
                    Width="320"
                    LabelWidth="130"
                    QueryMode="Local"
                    TypeAhead="true">
                    <Store>
                        <ext:Store runat="server" Data="<%# TestData %>" AutoDataBind="true">
                            <Model>
                                <ext:Model runat="server">
                                    <Fields>
                                        <ext:ModelField Name="abbr" />
                                        <ext:ModelField Name="name" />
                                        <ext:ModelField Name="slogan" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                            <Reader>
                                <ext:ArrayReader />
                            </Reader>
                        </ext:Store>
                    </Store>
                     <Listeners>
                        <BeforeQuery Handler="var q = queryEvent.query; 
    									     queryEvent.query = new RegExp(q, 'i');
    									      queryEvent.query.length = q.length;" />
                    </Listeners>
                </ext:ComboBox>
    
    
        </form>
    </body>
    </html>
  2. #2
    Hello Jimmy!

    Thanks for reporting the issue. Long story short, ExtJS turned a string parameter into a regex object parameter, then did not adapt a call that's triggered only is the circumstances you pointed (deleting the typed-ahead text with backspace or also with the delete key) to correctly use the parameter.

    The good news is that the fix is not really complex and we already applied it to our Ext.NET sources' base.

    We've logged this issue under #1443, if you want more info on the outcome check the issue out. If you build Ext.NET from sources you won't have this problem anymore.

    I searched a little but couldn't find some bug like that reported in Sencha forums, I guess that'll be a good idea to report this bug there, but regardless of that, we will keep an eye on this issue should Sencha ever fix it from their side, we remove the homebrew fix we just applied to sources.

    Hope this helps!

    p.s.: if you need the override instead of getting latest Ext.NET from sources, just check out the issue and commit to the github repository -- it should be straightforward to figure it out.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello again, Jimmy!

    It's been some days since we posted a follow-up here, and the issue was fixed on spot. It would be great if we could have your feedback whether the fix resolved or not the type ahead issue on the combo box you reported! So if you come back to this at some point, please leave us a follow-up on the issue so we can rest assured it was fixed.

    Thanks again for reporting the issue!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 6
    Last Post: Feb 21, 2014, 4:16 AM
  2. [CLOSED] Migration of BeforeQuery Listener
    By rmelancon in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 01, 2013, 3:47 PM
  3. Replies: 2
    Last Post: May 24, 2013, 1:54 AM
  4. [FIXED] [V0.8] TabFx Error
    By Timothy in forum Bugs
    Replies: 2
    Last Post: Apr 02, 2009, 10:02 AM
  5. [FIXED] [V0.8.0] desktop js error
    By [WP]joju in forum Bugs
    Replies: 20
    Last Post: Mar 17, 2009, 1:46 AM

Posting Permissions