Kendo 多个输入字段的调度程序数据源

Kendo Scheduler Datasource for multiple input field

在下面的示例中 - http://dojo.telerik.com/IqIYI/5 - 我试图了解数据应如何保存在我的数据库中(并因此提供给调度程序)。

这是我的自定义编辑模板。

<script id="editor" type="text/x-kendo-template">    <h3>Edit meeting</h3>    <p>
       <label>Title: <input name="title" /></label>    </p>    <p>
       <label>Start: <input data-role="datetimepicker" name="start" /></label>    </p>    <p>
       <label>End: <input data-role="datetimepicker" name="end" /></label>    </p>    <div class="k-edit-label">
        <label for="Contact">Contact</label>
    </div>
    <div data-container-for="Contact" class="k-edit-field">
        <select id="Contact" multiple="multiple" name="Contact"
            data-role="multiselect"
            data-bind="value:Contact"
            data-source='[
                { "text": "Person1", "value": 1 },
                { "text": "Person2", "value": 2 },
                { "text": "Person3", "value": 3 }
            ]'
            data-text-field="text"
            data-value-field="value"
            data-value-primitive="true"
            ></select>
    </div> </script>

我唯一事件的数据源(见示例右侧)如下:

dataSource: [
    {
      id: 1,
      start: new Date("2013/6/6 08:00 AM"),
      end: new Date("2013/6/6 09:00 AM"),
      title: "Interview",
      contact: "[1, 2]"
    }
  ]

..开始、结束日期和标题正确填充弹出窗口(当双击右侧的 "Interview" 事件以显示其内容时)。 但是,联系人字段未填写。 我尝试了以下方法无济于事,有人知道吗?

contact: [1,2]
contact: {1,2}
contact: [{1,2}]
contact: [{value:1, value:2}]

您模板中的名称和数据绑定不正确(小写 "c");你需要:

<div data-container-for="Contact" class="k-edit-field">
    <select id="Contact" multiple="multiple" name="contact"
        data-role="multiselect"
        data-bind="value:contact"
        data-source='[
            { "text": "Person1", "value": 1 },
            { "text": "Person2", "value": 2 },
            { "text": "Person3", "value": 3 }
        ]'
        data-text-field="text"
        data-value-field="value"
        data-value-primitive="true"
        ></select>
</div>

那么这个值将起作用:

contact: [1,2]

(demo)