Basically i'm trying to hide non-business hours on the click of "Show Business Hours" button in Scheduler. This is needed on demand.
Non-Business work hours - Saturday , Sunday (weekend) and 8 PM to 7 AM (Weekdays)
I need to set the flag $scope.isBusinessHour to either true or false based on whether user clicked on "Show Business hour" or "Show full day" button
If $scope.isBusinessHour set to true, then CustomView would be used which will in turn show Monday to Friday days in the week view (7AM to 8PM)
else default week view would be used.
But the problem is that i'm not able to find the "Show Business Hours" or "Show full day" button click event or function wherein i can set that flag to achieve this functionality.
Also if there is any better approach to achieve the same (To hide Non-Business work hours - Saturday , Sunday and 8 PM to 7 AM (Weekdays) on demand like on the click of "Show Business Hours" button in scheduler ) , could you suggest?
Week view is as below:
views: [
{
type: "day"
}, {
type: !$scope.isBusinessHour? "week" : CustomView, title: "Week",
selected: true,
workDayStart: new Date("2016/1/1 07:00 AM"),
workDayEnd: new Date("2016/1/1 08:00 PM")
}
]
var CustomView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "customView",
calculateDateRange: function () {
//create a range of dates to be shown within the view
var selectedDate = this.options.date,
start = kendo.date.dayOfWeek(selectedDate, this.calendarInfo().firstDay, -1),
idx, length,
dates = [];
for (idx = 0, length = 7; idx < length; idx++) {
if (start.getDay() != 0 && start.getDay() != 6) {
dates.push(start);
}
start = kendo.date.nextDay(start);
}
this._render(dates);
}
});