Jun 11, 2013, 4:09 PM
[CLOSED] Combo Box Autocompletion using characters from the middle of the display values
Hi there,
I am trying to get my ComboBox to auto complete as I type. It is working fine if I start with the beginning of the string e.g. 1003. However If I start with a character from the middle like "London" it doesn't auto complete. Is there a way to achieve this?
My ComboBox contains the list below:
1001 New York
1002 Mumbai
1003 Berlin
1004 Istanbul
1005 London
I am trying to get my ComboBox to auto complete as I type. It is working fine if I start with the beginning of the string e.g. 1003. However If I start with a character from the middle like "London" it doesn't auto complete. Is there a way to achieve this?
My ComboBox contains the list below:
1001 New York
1002 Mumbai
1003 Berlin
1004 Istanbul
1005 London
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyCombo.aspx.cs" Inherits="OffLineExtTest.Pages.MyCombo" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
List<string> cities = new List<string>();
cities.Add("New York");
cities.Add("Mumbai");
cities.Add("Berlin");
cities.Add("Istanbul");
cities.Add("London");
List<Location> LocationList = new List<Location>();
for (int i = 1; i < 5; i++)
{
var name = cities.ElementAt(i);
var location = new Location()
{
LocationKey = 1000+i,
LocationName = 1000 + i+ " " +name
};
LocationList.Add(location);
}
stLocationStore.DataSource = LocationList;
stLocationStore.DataBind();
}
}
public class Location
{
public int LocationKey { get; set; }
public string LocationName { get; set; }
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:ComboBox ID="cmbLocation" Name="recKey" runat="server" TypeAhead="true" MinChars="1"
MatchFieldWidth="false" DisplayField="LocationName" ValueField="LocationKey" EmptyText="Select Location"
Editable="true" ForceSelection="true" AllowBlank="false" Mode="Local" AutoSelect="true"
Width="300" FieldLabel="Location">
<Store>
<ext:Store ID="stLocationStore" runat="server">
<Model>
<ext:Model ID="Model4" runat="server" IDProperty="Divnum">
<Fields>
<ext:ModelField Name="LocationKey" />
<ext:ModelField Name="LocationName" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
</ext:ComboBox>
</form>
</body>
</html>
Last edited by Daniil; Jul 02, 2013 at 4:02 AM.
Reason: [CLOSED]