我在列表视图中使用 Kendo UI 下拉列表
<ul data-role="listview" id="participants-listview" data-style="inset" data-template="participants-listview-template" data-bind="source: participants, events { click: onSelectParticipant }" />
<script type="text/x-kendo-template" id="listview-template">
<div>
<span>#:RoleDesc#</span>
<span>
<select data-role="dropdownlist" id="status-id"
data-text-field="StatusDesc"
data-value-field="StatusId"
data-bind="value: StatusId, source: participantStatuses, events: { change: onParticipantStatusChange }"
name="Status"
required="required"
validationMessage="required">
</select>
</span>
</div>
</script>
Run Code Online (Sandbox Code Playgroud)
视图模型
viewModel = kendo.data.ObservableObject.extend({
dataSource: new kendo.data.DataSource({
transport: {
type: "odata",
read: {
url: function() {
return meetings/participants";
}
}
}
}),
participants: [], //listview data
participantStatuses: [ // dropdownlist selection
{ StatusId: 1, StatusDesc: "Invited" …Run Code Online (Sandbox Code Playgroud)