This is a migrated thread and some comments may be shown as answers.
Show full day manually
2 Answers 26 Views
This is a migrated thread and some comments may be shown as answers.
Kumeri
Top achievements
Rank 1
Kumeri asked on 03 Jan 2019, 12:12 PM

Hi, 

in the workweekview when I have events with intervals outside of business hours it would be desirable that full day is shown by default. Is there is a way to trigger the show full day command from my side once i know there are events outside business hours?  

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 07 Jan 2019, 09:39 AM
Hi Kumeri,

In general, the described behavior could be achieved as follows:


I have prepared a Dojo example, where the above functionality is implemented as follows:
dataBound: function(e) {
    var scheduler = e.sender;
    var view = this.view();
     
    if (!view.startTime || !view.endTime) {
        return;
    }
 
    var events = this.dataSource.expand(view.startDate(), view.endDate());
 
    var startTime = kendo.date.getMilliseconds(view.startTime());
    var endTime = kendo.date.getMilliseconds(view.endTime());
    var showPrev;
    var showNext;
 
    for (var idx = 0; idx < events.length; idx++) {
        if (events[idx].isAllDay) {
            continue;
        }
 
        if (kendo.date.getMilliseconds(events[idx].start) < startTime) {
            showPrev = true;   
        }
 
        if (kendo.date.getMilliseconds(events[idx].end) > endTime &&
            endTime > startTime) {
            showNext = true;   
        }
    }
 
    if(showPrev || showNext) {
        $(scheduler.wrapper.find(".k-scheduler-fullday .k-link")[0]).click();  
        $(scheduler.wrapper.find(".k-scheduler-fullday .k-link")[0]).hide();
    }
}

Important to note is that in order for the above behavior to work, the Scheduler's "Show Business Hours" button has to be hidden. Otherwise, clicking on it will trigger the dataBound event again and the view state will not be changed.

I hope this helps.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Kumeri
Top achievements
Rank 1
answered on 23 Jul 2019, 09:51 AM
Thank you 
Asked by
Kumeri
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Kumeri
Top achievements
Rank 1
Share this question
or