如何使用mvvm在日历中设置多个日期?

时间:2017-11-16 11:58:55

标签: javascript kendo-ui calendar kendo-template

如何使用mvvm在日历中设置多个日期。

我有我的日历:

<div id="calendar1" data-role="calendar"
          data-bind="value: Cvalue,
          dates: Csource,
          events:{change: ConChange}">
</div>

JS,查看模型:

Cvalue:null,
Csource:[],
Conchange:function(){
}

Csource包含:

[
 {"nome":"1"},{"data":"21/112017"},
 {"nome":"2"},{"data":"22/112017"},
 {"nome":"3"},{"data":"26/112017"},
 {"nome":"4"},{"data":"28/112017"},
 {"nome":"5"},{"data":"29/112017"}
 ]

该隐我在日历中看到不同颜色的日期?

在onChange,我想打印日期的名称; 像这附加图像:

enter image description here

1 个答案:

答案 0 :(得分:1)

名为multiDatesPicker的插件将满足您的要求

&#13;
&#13;
$('#mdp-demo').multiDatesPicker();
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdn.rawgit.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.css" rel="stylesheet"/>
<link href="https://code.jquery.com/ui/1.12.1/themes/pepper-grinder/jquery-ui.css" rel="stylesheet"/>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdn.rawgit.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.js"></script>
<input id="mdp-demo">
&#13;
&#13;
&#13;