Jun 05, 2016, 1:19 PM
[CLOSED] reload combobox's store from controller action on click of combobox
i have a combobox in razor view with a store defined.
How can i reload the store (trigger controller action) on every click of the combo
////this is the view code
How can i reload the store (trigger controller action) on every click of the combo
////this is the view code
.Items(Html.X().ComboBox()
.ID("cmbid")
.Name("cmbname")
.Editable(false)
.FieldLabel("Select value")
//.TypeAhead(true)
.Width(250)
.QueryMode(DataLoadMode.Default)
.ForceSelection(true)
.TriggerAction(TriggerAction.All)
.DisplayField("name")
.ValueField("id")
.EmptyText("Loading...")
.ValueNotFoundText("Loading...")
.Store(Html.X().Store()
.AutoLoad(false)
.Model(Html.X().Model()
.IDProperty("Id")
.Fields(
new ModelField("id", ModelFieldType.String) { Mapping = "Id" },
new ModelField("name", ModelFieldType.String) { Mapping = "Name" }
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("controllerstore_Action"))
.Reader(Html.X().JsonReader().RootProperty("data"))
)
.Parameters(ps =>
ps.Add(new StoreParameter("parameter_id", "App.textfield1.getValue()", ParameterMode.Raw))
)
.Listeners(ls =>
ls.Load.Handler = @"var combo = App.cmbid;
combo.setValue(records[0].get(combo.valueField));"
)
)//end store
)//combo items ends
///==========controller code
public ActionResult Reload_Combo(string parameter_id)
{
try
{
return this.Store(somedata.GetComboData(parameter_id));
}
catch (System.Exception)
{
throw;
}
}
Last edited by fabricio.murta; Jun 06, 2016 at 9:16 PM.