I have a kendo grid and I'm creating a template for editing the grid data, but I'm having problems with the code below ... Home This is part of my template code:
<script id="popup_editor" type="text/x-kendo-template">
<div class="k-edit-label">
<label for="Sexo">Sexo</label>
</div>
<input name="Sexo"
data-bind="value:Sexo"
data-value-field="sexoValue"
data-text-field="sexoName"
data-source="sexoDropDownDataSource"
data-role="dropdownlist" />
</script>
This is my script to populate dropdownlist
with the required data:
sexoDropDownDataSource = new kendo.data.DataSource({
autoBind: false,
dataTextField: "sexoName",
dataValueField: "sexoValue",
data: [
{ sexoName: "Masculino", sexoValue: "M" },
{ sexoName: "Feminino", sexoValue: "F" }
]
});
As you can see, everything is fine, and the code is working perfectly bringing the value on the grid, but the problem is that even with autoBind
getting value false
dropdownlist
is coming with the first always selected (in masculino
), that is, when the data of a person of gender feminino
is edited, dropdownlist
shows the value that came from the grid ( feminino
), but when it is the two selected values are displayed. How can I resolve this?
Look what I'm talking about: