如何以编程方式调用 Kendo Ui 调度程序的导航事件

How do programatically invoke navigate event for Kendo Ui Scheduler

我想将工具栏控件的位置移到调度程序块之外。

如何从工具栏但在我自己的自定义按钮上调用下一个和上一个按钮执行的相同命令。

请参阅下面的代码片段。

在代码中,我将当前日期的'date'部分增加或减少1,然后将其反馈给调度程序。它会在月份和年份的结束或开始时自动工作。

<!DOCTYPE html>
<html>
<head>
    <base href="https://demos.telerik.com/kendo-ui/scheduler/events">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.620/styles/kendo.material.mobile.min.css" />

    <script src="https://kendo.cdn.telerik.com/2018.2.620/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2018.2.620/js/kendo.all.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2018.2.620/js/kendo.timezones.min.js"></script>
    

    <link rel="stylesheet" href="../content/shared/styles/examples-offline.css">
    <script src="../content/shared/js/console.js"></script>
</head>
<body>
<div id="example">
  <button onclick="prev()">Previous</button>
  <button onclick="next()">Next</button>

  <div id="scheduler"></div>
</div>
<script>
  $("#scheduler").kendoScheduler({
    dataSource: [
      {
        id: 1,
        start: new Date("2013/6/6 08:00 AM"),
        end: new Date("2013/6/6 09:00 AM"),
        title: "Interview"
      }
    ]
  });
  
  function next() {
    let scheduler = $("#scheduler").data("kendoScheduler");
    let date = scheduler.date();
   date.setDate(date.getDate() + 1);
   scheduler.date(date);
  }
  
  function prev() {
    let scheduler = $("#scheduler").data("kendoScheduler");
    let date = scheduler.date();
   date.setDate(date.getDate() - 1);
   scheduler.date(date);
  }
</script>

</body>
</html>