I have a ListView template that contains an index field (VentTypeId) and a text field (VentDescription) that shows text for the index field. The text field getter does a lookup up for the text corresponding to the index field. I have an EditorTemplate with a dropdownlist to modify the index field, and after the save the index field is changed but the text field is not. I suppose I need to indicate that the text field has to be re-bound in the template after the edit, but don't know how.
Here is the relevant part of the View:
@(Html.Kendo().ListView<
VentSetting
>()
.Name("VentSettings")
.TagName("div")
.ClientTemplateId("ventTemplate")
.Editable()
.DataSource(datasource => datasource
.Model(model => model.Id(m => m.VentSettingId))
.Read(read => read.Action("ReadVentSettings", "Run"))
.Update(update => update.Action("UpdateVentSetting", "Run"))
)
)
The relevant part of the template. Here the VentTypeId displays the changed value but the VentDescription field does not:
<
script
type
=
"text/x-kendo-tmpl"
id
=
"ventTemplate"
>
<
div
>
<
span
>VentTypeId:</
span
><
span
>#:VentTypeId#</
span
>
<
span
>Vent:</
span
><
span
>#:VentDescription# </
span
>
</
div
>
</
div
>
</
script
>
The relevant parts of the EditorTemplate
<
div
>
@Html.Kendo().DropDownListFor(x => x.VentTypeId)
.DataValueField("VentTypeId")
.DataTextField("Description")
.BindTo((System.Collections.IEnumerable)ViewData["VentTypes"])
<
div
class
=
"edit-buttons"
>
<
a
class
=
"k-button k-button-icontext k-update-button"
href
=
"\\#"
><
span
class
=
"k-icon k-update"
></
span
>Save</
a
>
<
a
class
=
"k-button k-button-icontext k-cancel-button"
href
=
"\\#"
><
span
class
=
"k-icon k-cancel"
></
span
>Cancel</
a
>
</
div
>
</
div
>
The relevant parts of the VentSetting model:
public class VentSetting
{
public int VentTypeId { get; set; }
public string VentDescription
{
get
{
return VentTypeId == null ? "" : GetVentTypes().Single(v => v.VentTypeId == VentTypeId).Description;
}
}
}
Any help would be appreciated.
Steve
Uncaught TypeError: Cannot set property 'en-US' of undefined kendo.core.js:472
kendo.cultures[
"en-US"
] = {
kendo.cultures = {
"en-US"
: {
function onSelectProvider(arg) {
$("#scheduler").filter = { field: "Idd", operator: "eq", value: arg.Text };
$("#scheduler").dataSource.read();
}
<!doctype html>
<
html
>
<
head
>
<
title
>Kendo UI Web</
title
>
<
link
href
=
"styles/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"styles/kendo.default.min.css"
rel
=
"stylesheet"
/>
<
script
src
=
"js/jquery.min.js"
></
script
>
<
script
src
=
"js/kendo.web.min.js"
></
script
>
</
head
>
<
body
>
<
div
id
=
"grid"
></
div
>
<
script
>
$(document).ready(function () {
var myDataSource = new kendo.data.DataSource({
transport: {
read: {
url: "people.json",
dataType: "json"
}
}
});
$("#grid").kendoGrid({
dataSource: myDataSource,
columns: [
{
field: "firstName",
title: "First Name"
},
{
field: "lastName",
title: "Last Name"
}]
});
});
</
script
>
</
body
>
</
html
>
{
"people": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}