I am using a grid to display system user information and have followed the guide for "Edit Records Using External Forms"
I need to implement a drop down editor for a few of the data fields associated with the user (country, userGroup, Roles) and have been struggling to accomplish that goal.
When I select a user I am using MVVM to populate the fields with the existing information.
This works great for text fields. But fields that require a drop down, will populate with the data source options but will not start with the correct selection already associated with the user.
I hope this is enough information to convey my issue. Let me know if I can provide anything else.
<
input
data-role
=
"dropdownlist"
data-text-field
=
"name"
data-value-field
=
"groupID"
data-bind="value: selected.groupID,
source: loginGroupsDS"
/>
...
var userViewModel = kendo.observable({
...
loginGroupsDS: new kendo.data.DataSource({
transport: {
read: {
type: 'POST',
dataType: 'json',
url: crudServiceBaseUrl+'getLoginGroups'
}
},
schema: {
data: "groups"
}
}),
selected: {},
...
}
// where selected contains the data from the select grid row
// loginGroupsDS returns data in the form
groups: {[
{groupID: 2, name: "Administrator"}
]
}
// userViewModel.selected has the same form
selected.groupID: {groupID: 2, name: "Administrator"}