[CLOSED] ext.net combobox filter problem with Turkish characters

  1. #1

    [CLOSED] ext.net combobox filter problem with Turkish characters

    Hi,

    When user wants to filter data in an editable combobox that contains Turkish characters like 'İ' in values, filter does not work as user wants. When the user types 'i' as filter character, I think it's converted to 'I' character (because the value is in upper case) and if the value in combobox contains 'İ' character, no result is returned.

    Is there any way to convert this 'i' character to 'İ' character as upper?

    Regards.
    Last edited by fabricio.murta; Sep 03, 2015 at 7:49 PM. Reason: [CLOSED]
  2. #2
    Hi @metci,

    I don't think uppercasing happens there. The reason why typing "i" doesn't show items that contains "İ", because this returns false in JavaScript.
    new RegExp("i", "i").test("İ")
    I was able to come up with the following hack. Though, I am not sure it will work in all cases. Please test.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "1", "İ 1" },
                    new object[] { "2", "i two" },
                    new object[] { "3", "İ three" },
                    new object[] { "4", "Four" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var onBeforeQuery = function (queryPlan) {
                queryPlan.query = new RegExp(queryPlan.query + "|" + queryPlan.query.replace("i", "İ"));
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:ComboBox 
                ID="ComboBox1" 
                runat="server" 
                DisplayField="text" 
                ValueField="value"
                QueryMode="Local">
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="value" />
                                    <ext:ModelField Name="text" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Reader>
                            <ext:ArrayReader />
                        </Reader>
                    </ext:Store>
                </Store>
                <Listeners>
                    <BeforeQuery Fn="onBeforeQuery" />
                </Listeners>
            </ext:ComboBox>
        </form>
    </body>
    </html>
  3. #3
    Seems working fine with the query below.

    Thanks.

    var onBeforeQuery = function (queryPlan) {
          queryPlan.query = new RegExp(queryPlan.query + "|" + queryPlan.query.replace("i", "İ") + "|" + queryPlan.query.replace("İ", "i"));
    };

Similar Threads

  1. Replies: 6
    Last Post: Dec 24, 2014, 6:41 AM
  2. Replies: 8
    Last Post: Mar 15, 2013, 3:24 AM
  3. Turkish Character Problem
    By mikser in forum 2.x Help
    Replies: 0
    Last Post: May 04, 2012, 1:30 PM
  4. [CLOSED] Turkish special characters problem
    By tansu in forum 1.x Premium Help
    Replies: 6
    Last Post: May 26, 2009, 1:01 PM

Posting Permissions