How to change view date dynamically (which is filter event by date time)

那年仲夏 提交于 2019-12-04 23:14:28

Several issues here - the day view shows just one day; you can't set startDate and endDate - just date.

$scope.searchEventByDate = function (item) {
  var scheduler = $("#scheduler").data("kendoScheduler");
  //scheduler.view().startDate(item.StartDate);
  //scheduler.view().endDate(item.EndDate);
  scheduler.view("day");
  // item.StartDate should be Date object - like scheduler.date(new Date("2013/6/6"));
  scheduler.date(item.StartDate);
  $scope.scheduler.dataSource.read();       
};

If you need to set some explicit date range to filter - you can do it, but still you can't show more than just one day in day view.

$scope.searchEventByDate = function (item) {
  var scheduler = $("#scheduler").data("kendoScheduler");
  scheduler._myFilterStartDate = item.StartDate;
  scheduler._myFilterEndDate = item.EndDate;
  scheduler.view("day");
  scheduler.date(item.StartDate);
  $scope.scheduler.dataSource.read();       
};      

And in parameter map:

...
return {
  filterByStartDate: scheduler.view().startDate(),
  filterByEndDate: scheduler.view().endDate(),
  myFilterStartDate: scheduler._myFilterStartDate,
  myFilterEndDate: scheduler._myFilterEndDate,
  OrgId: _orgId,
  UserTimezone: global.userTimezoneOffset
};
...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!