0

我正在尝试为剑道调度程序定义单独的营业时间。剑道调度程序只为每个工作日使用一个开始/结束时间。我想专门定义每一天的开始/结束时间(即星期一与星期二的时间不同)。

最近有人问了这个问题

http://www.telerik.com/forums/set-business-hours-for-individual-days

我想知道是否有人扩展了视图以添加类似的功能。

我无权访问视图的非缩小版本(kendo.ui.DayView、kendo.ui.WeekView)。基于 kendo.scheduler.dayview.min.js 文件,我假设我必须扩展 DayView,并覆盖 _content 函数,但是我无法将该函数的缩小版本复制到扩展视图中.

我目前正在使用 jQuery 循环遍历时间段,以便在数据绑定事件上为此添加一个 css 类,但是,如果您在每周视图中并且将主要刻度设置为 5,则性能可能会非常糟糕。

遍历时隙的代码类似于 http://www.telerik.com/forums/color-code-resource-unavailable-days-hours

dataBound: function (e) {
    var scheduler = this;
    var view = scheduler.view();

    view.table.find("td[role=gridcell]").each(function () {
        var element = $(this);
        var slot = scheduler.slotByElement(element);
        //your custom logic based on the slot object
        if (true) {
            element.addClass("customClass");
        }
    })
}
4

1 回答 1

3

要具体定义每一天的开始/结束时间,请使用 scheduler.eg 的“导航”方法中的“schedulerInstance.options”属性

 navigate: function (e) {
       var schedulerInstance = $("#schedulerInterface").data('kendoScheduler');
       var options = schedulerInstance.options;  

       switch (new Date().getDay()) 
       {
        case 0:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        case 1:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        case 2:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        case 3:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        case 4:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        case 5:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        case  6:
           options.startTime = // Your start time;
           options.endTime = //Your end time;
           break;
        }                        
    }

希望能帮助到你。

于 2014-09-10T09:27:30.383 回答