Oct 25, 2012, 6:05 AM
[CLOSED] Combobox Change/Select handler only fires one
I have a combo box and i need to fire a select or change event when user selects a different item in combobox When I assign a Listner Handler .Listeners(l=>l.Change.Handler = ("SelectItemChange(this);")) it will fire once but nor after that
SeacrhControl.cshtml
SeacrhControl.cshtml
<script>
function SelectItemChange(combo) {
var id = combo.getDisplayValue();
alert(id);
}
</script>
@(Html.X().Panel()
.AutoDoLayout(true)
.BodyBorder(0)
.Border(false)
.Layout("Table")
.Items(i => i.Add(
(Html.X().Button()
.Text("Delete")
)))
.Items(i => i.Add(
(Html.X().ComboBox()
.Border(false)
.Listeners(l=>l.Change.Handler = ("SelectItemChange(this);"))
.Editable(false)
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
.SelectOnFocus(true)
.EmptyText("Loading.....")
.DisplayField("COLUMN_NAME")
.ValueField("DATA_TYPE")
.PageSize(10)
.TypeAhead(true)
.Store(
(Html.X().Store()
.PageSize(10)
.AutoLoad(true)
.RemotePaging(false)
.AutoDataBind(true)
.Proxy(
(Html.X().AjaxProxy()
.Url(Url.Action("BuildStoreColumnList"))
)
.ActionMethods(a => a.Read = HttpMethod.GET)
.Reader(
(Html.X().JsonReader()
.Root("data")
)
))
)
.Model(m =>
m.Add((Html.X().Model()
.Fields(f =>
{
f.Add((Html.X().ModelField()
.Name("COLUMN_NAME")
.Type(ModelFieldType.String)
));
f.Add((Html.X().ModelField()
.Name("DATA_TYPE")
.Type(ModelFieldType.String)
));
}
)
)
)
)
)
.Tpl(
(Html.X().XTemplate()
.Html(@" <Html>
<tpl for=""."">
<tpl if=""[xindex] == 1"">
<table class=""cbStates-list"" width=""100%"">
<tr>
<th>COLUMN_NAME</th>
<th>DATA_TYPE</th>
</tr>
</tpl>
<tr class=""x-boundlist-item"">
<td>{COLUMN_NAME}</td>
<td>{DATA_TYPE}</td>
</tr>
<tpl if=""[xcount-xindex]==0"">
</table>
</tpl>
</tpl>
</Html>")
)
)
)
))
.Items(i => i.Add(
(Html.X().ComboBox()
.Border(false)
.Editable(false)
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
.SelectOnFocus(true)
.EmptyText("Loading.....")
.DisplayField("OperatorId")
.ValueField("OperatorValue")
.PageSize(10)
.TypeAhead(true)
.Store(
(Html.X().Store()
.PageSize(10)
.AutoLoad(true)
.RemotePaging(false)
.AutoDataBind(true)
.Proxy(
(Html.X().AjaxProxy()
.Url(Url.Action("GetOperators"))
)
.ActionMethods(a => a.Read = HttpMethod.GET)
.Reader(
(Html.X().JsonReader()
.Root("data")
)
))
)
.Model(m =>
m.Add((Html.X().Model()
.Fields(f =>
{
f.Add((Html.X().ModelField()
.Name("OperatorId")
.Type(ModelFieldType.String)
));
f.Add((Html.X().ModelField()
.Name("OperatorValue")
.Type(ModelFieldType.String)
));
}
)
)
)
)
)
.Tpl(
(Html.X().XTemplate()
.Html(@" <Html>
<tpl for=""."">
<tpl if=""[xindex] == 1"">
<table class=""cbStates-list"" width=""100%"">
<tr>
<th>Operator Id</th>
<th>Value</th>
</tr>
</tpl>
<tr class=""x-boundlist-item"">
<td>{OperatorId}</td>
<td>{OperatorValue}</td>
</tr>
<tpl if=""[xcount-xindex]==0"">
</table>
</tpl>
</tpl>
</Html>")
)
)
)
))
.Items(i => i.Add(
(Html.X().TextField()
.Border(false)
.Width(150)
// .ID(Guid.NewGuid().ToString())
.SelectOnFocus(true)
.EmptyText("Loading.....")
)))
)
Last edited by Daniil; Oct 30, 2012 at 3:22 PM.
Reason: [CLOSED]