[CLOSED] ComboBox: search not necessary at beginning

  1. #1

    [CLOSED] ComboBox: search not necessary at beginning

    Hello,

    I declare a combobox with local mode. I want to be able to do a search which not begin at the start of each item in the combo store which the default behavior of the combobox. Is there any option to set or how can I do it?

    Thanks in advance.

    Romuald.
    Last edited by Daniil; Apr 09, 2011 at 12:43 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Imagine that there are the following items in the ComboBox: a, ab, ac, ba, bc.

    When type 'a' you need to show 'ba' and 'bc'.
    When type 'a' you need to show 'a', 'ab' and 'ac'.

    Do I understand you right?
  3. #3
    Thank for your reply.

    With your example

    Imagine that there are the following items in the ComboBox: a, ab, ac, ba, bc.

    When type 'a' I need to show all items that contain 'a'. For example 'a', 'ab', 'ac', 'ba'.

    For example if the contains 'Contact' when I type 'act' I need to show the 'Contact' items.

    To summarize the filter criteria is 'contain or any match' and not 'start with'

    Hope you understand

    Romuald.
  4. #4
    Thanks for the clarification, I understand now.

    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <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", "a" },
                    new object[] { "2", "ba" },
                    new object[] { "3", "aa" },
                    new object[] { "3", "cca" },
                    new object[] { "3", "cb" },
                    new object[] { "3", "cbd" }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var onKeyUp = function (combo, e) {            
                var v = combo.getRawValue();
                combo.store.filter(combo.displayField, new RegExp(v));
                combo.onLoad();
            };
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:ComboBox ID="ComboBox1" runat="server" EnableKeyEvents="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="value" />
                                <ext:RecordField Name="text" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <Listeners>
                <KeyUp Fn="onKeyUp" />
            </Listeners>
        </ext:ComboBox>
        </form>
    </body>
    </html>
    Last edited by Daniil; Aug 06, 2012 at 11:31 AM.
  5. #5
    Here is a related Ext.NET v2 discussion.
    http://forums.ext.net/showthread.php?20403

Similar Threads

  1. [CLOSED] Custom Search Combobox
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 02, 2011, 1:40 PM
  2. [CLOSED] Sub Search for combobox
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 19, 2011, 9:31 AM
  3. [CLOSED] Combobox Search not working
    By Suntico in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 18, 2011, 5:23 AM
  4. [CLOSED] Combobox: issue with search
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 14, 2010, 6:37 PM
  5. [CLOSED] [1.0] ComboBox Custom Search
    By Ben in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 01, 2009, 7:00 PM

Tags for this Thread

Posting Permissions