Hi,
I have a grid that is bound to an external datasource. One of the colums on edit is a dropdown list with possible value. When I select a new value and save, the data-value field is shown instead of the data-text. How can I fix this? Please find my grid code below.
var
sizes =
new
kendo.data.DataSource({
data: data.ProductSize,
schema: {
model: {
id:
"Id"
,
fields: {
Name: { type:
"string"
}
}
}
}
});
$(
"#sizegrid"
).kendoGrid({
dataSource: sizes,
pageSize: 20,
sortable:
false
,
columns: [{
field:
"Name"
,
title:
"Size"
,
editor: UnitSizeDropDownEditor
},{
field:
"PriceExcVat"
,
title:
"Price Exc VAT"
},{
field:
"PurchasePrice"
,
title:
"Purchase Price"
},{
command: [
"edit"
,
"destroy"
], title:
" "
}],
editable:
"popup"
});
kendo.ui.progress($(
"#tabstrip"
),
false
);
})
And the template for the dropdown
function
UnitSizeDropDownEditor(container, options) {
$(
'<input required data-text-field="Name" data-value-field="Id" data-bind="value:'
+ options.field +
'"/>'
)
.appendTo(container)
.kendoDropDownList({
autoBind:
false
,
dataSource: {
transport: {
read: {
url: uri,
dataType:
"json"
,
data: {
"LanguageID"
: 1}
}
},
schema: {
model: {
id:
"Id"
,
fields: {
Name: { type:
"string"
}
}
}
}
}
});
}