PDA

View Full Version : [CLOSED] Multiple Combo-boxes - Same Store - Odd Behavior



adelaney
Jun 13, 2012, 12:58 PM
I have a grid with a RowEditing plugin. When in edit mode, I have four of the fields which each have a combo-box editor (employee names/ids) which all use the EmployeeData store. Each of the combo-boxes have unique IDs are are configured in the markup. When using the combo-boxes in simple, drop-down and mousing to select an item, they all work fine. However, if I use the type-ahead feature and type a name in one box, they all are filtered for that value. I don't think this is normal behavior. However, I am not sure what to expect when using a single store. For clarification here is the store:


@(Html.X.Store().ID("EmployeeData") _
.DataSource(ViewData("Employees")) _
.Reader(Sub(rdr)
rdr.Add(New Ext.Net.JsonReader())
End Sub) _
.Model(Sub(mdl)
mdl.Add(Html.X.Model.Fields(Sub(flds)
flds.Add("Selected", Ext.Net.ModelFieldType.Boolean)
flds.Add("Text")
flds.Add("Value", Ext.Net.ModelFieldType.Int)
End Sub).IDProperty("Value"))
End Sub))


Here is one combo:

cols.Add(Html.X.Column().DataIndex("DrafterEmployeeID").Text("Drafter").Renderer(New Ext.Net.Renderer() With {.Fn = "employeeRenderer"}).Editor(Sub(edt)
Dim cbo As New Ext.Net.ComboBox
With cbo
.ID = "DrafterEmployeeID"
.StoreID = "App.EmployeeData"
.MultiSelect = False
.AutoDataBind = True
.QueryMode = DataLoadMode.Local
.TypeAhead = True
.DisplayField = "Text"
.ValueField = "Value"
End With
edt.Add(cbo)
End Sub))

Again, the only differences in the 4 colums are:
Column - different data index, different text
Combo - different ID

Daniil
Jun 13, 2012, 2:21 PM
Hi,

Please try to set up

<Focus Handler="this.getStore().clearFilter();" />
listener for the ComboBox.

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)
{
this.Store1.DataSource = new object[]
{
new object[] { "1", "a" },
new object[] { "2", "b" },
new object[] { "3", "c" }
};
this.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 runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Store ID="Store1" 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>
<ext:ComboBox runat="server" StoreID="Store1" QueryMode="Local">
<Listeners>
<Focus Handler="this.getStore().clearFilter();" />
</Listeners>
</ext:ComboBox>
<ext:ComboBox runat="server" StoreID="Store1" QueryMode="Local">
<Listeners>
<Focus Handler="this.getStore().clearFilter();" />
</Listeners>
</ext:ComboBox>
</form>
</body>
</html>

adelaney
Jun 13, 2012, 4:23 PM
That did it. Thank you.