PDA

View Full Version : [CLOSED] ComboBox after store load event



registrator
Apr 07, 2015, 11:09 AM
Is there an event where I can set a combo box selected item after the combo box store loads?



X.ComboBoxFor(m => m.TAX_CODE).FieldLabel("Tax Code").LabelWidth(80).ID("TaxCode")
.ValueField("TaxCodeID")
.AllowBlank(true)
.TypeAhead(true)
.ForceSelection(true)
.ListConfig(Html.X().BoundList()
.ItemTpl(Html.X().XTemplate()
.Html(@<text>
<div class="list-item">
<h3>{Name} - Rate: {RATE}%</h3>
{DESCRIPTION}
</div>
</text>)
)
)
.DisplayTpl(Html.X().XTemplate()
.Html(@<text>
<tpl for=".">
{Name} - Rate: {RATE}
</tpl>
</text>)
)
.Store(X.Store()
.ID("TaxCodeComboStore")
.AutoLoad(true)
.Model(
X.Model()
.Name("TaxCodeComboForCombo")
.IDProperty("TaxCodeID")
.Fields(
X.ModelField()
.Name("Name")
.Type(ModelFieldType.String),
X.ModelField()
.Name("DESCRIPTION")
.Type(ModelFieldType.String),
X.ModelField()
.Name("RATE")
.Type(ModelFieldType.Float)
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetList", "List", new { area = "TaxCode" }))
.Reader(Html.X().JsonReader().Root("data"))
)

Daniil
Apr 07, 2015, 1:25 PM
Hi @registrator,

Please use a Store's Load event.

A ComboBox doesn't fire that event in its context.