Dec 20, 2011, 1:06 PM
[CLOSED] ComboBox: Unable to enter a new value that matches to one of existing item IDs
Hi All,
I have a combobox with a list of predefined values. Although I need to allow user to enter some new value (have ForceSelection="false" to make it work). Everything is going well, until user tries to enter numbers which equal to IDs of predefined items.
Please take a look to the example below. Just enter 1 or 2 into the combobox and click somewhere to remove input focus. Text will change to "item 1" or "item 2".
Looks like combo treats its input text as item ID at some point.
Is there any known workaround?
Thanks
I have a combobox with a list of predefined values. Although I need to allow user to enter some new value (have ForceSelection="false" to make it work). Everything is going well, until user tries to enter numbers which equal to IDs of predefined items.
Please take a look to the example below. Just enter 1 or 2 into the combobox and click somewhere to remove input focus. Text will change to "item 1" or "item 2".
Looks like combo treats its input text as item ID at some point.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
var list = new List<object>();
list.Add(new { ID = 1, Name = "item 1" });
list.Add(new { ID = 2, Name = "item 2" });
Store1.DataSource = list;
Store1.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 id="Head1" runat="server">
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID"/>
<ext:RecordField Name="Name"/>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:ComboBox ID="Category" runat="server" AllowBlank="false"
TypeAhead="false" Mode="Local" ForceSelection="false" SelectOnFocus="false"
StoreID="Store1" ValueField="ID" DisplayField="Name" EmptyText="Select a Category">
</ext:ComboBox>
</body>
</html>
Is there any known workaround?
Thanks
Last edited by Daniil; Dec 27, 2011 at 2:35 PM.
Reason: [CLOSED]