小编xli*_*inc的帖子

剑道 UI 下拉列表数据绑定值

我在列表视图中使用 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)

javascript kendo-ui kendo-mobile icenium kendo-mvvm

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

icenium ×1

javascript ×1

kendo-mobile ×1

kendo-mvvm ×1

kendo-ui ×1