Which event "Show Business Hours" or "Show full day" button click will trigger?

3 posts, 1 answers
  1. Matt Dufrasne
    Matt Dufrasne avatar
    23 posts
    Member since:
    Aug 2009

    Posted 15 Sep Link to this post

    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);
                    }

                });

  2. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 16 Sep Link to this post

    Hi Matt,

    Please note that by default the Scheduler hides all non-working hours in the working days when you press the "Show Business hours" button. To hide the non-working days you should switch the view to "workWeek" view. 

    Also the event that is triggered when you press this button is the "navigate" event with following params:

    navigate: function(e) {
      if (e.action === "changeWorkDay") {
        //Show work / full day button is pressed.
      }
    },

    Regards,
    Vladimir Iliev
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
  4. Matt Dufrasne
    Matt Dufrasne avatar
    23 posts
    Member since:
    Aug 2009

    Posted 16 Sep in reply to Vladimir Iliev Link to this post

    Thanks Vladimir.
Back to Top