Views

28 May 20199 minutes to read

The number of days and its associated appointments are usually grouped together in Scheduler to organize different views. The available view options in Scheduler are as follows,

  • Day
  • Week
  • Workweek
  • Month
  • Custom View
  • Agenda
  • Timeline View

Usually these view options are displayed as a toolbar in the date-header section of the Schedule control. The items within the views toolbar can be added/removed based on the value passed to the Views property.

By default, the Schedule control’s active view is Week view. Also, it is possible to change the active view of the Scheduler by setting CurrentView option with the required view name as depicted below.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" Views="Day,WorkWeek" CurrentView="Workweek" CurrentDate="5/2/2014">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    Day

    It represents a single day Scheduler view (single date display) with all its related appointments.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData"  CurrentView="Day" CurrentDate="5/2/2014">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    Week

    It’s a view displaying a count of 7 days (from Sunday to Saturday) with all its related appointments. The first day of the week can be changed using the FirstDayOfWeek API which accepts either the integer (Sunday=0, Monday=1, Tuesday=2, etc) or string (“Sunday”, “Monday”, etc) or ej.Schedule.DayOfWeek enum type value. The default value of this firstDayOfWeek depends on the current culture (language) used in the Scheduler.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData"  CurrentView="Week" FirstDayOfWeek="Monday" CurrentDate="5/2/2014">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    Work Week

    Work week view displays the working days of the week (count of 5 days) and its associated appointments. It is also possible to customize the days to be displayed in the work week view using WorkWeek API which accepts the string array such as [“Monday”, “Tuesday”, “Wednesday”, “Thursday” and “Friday”]. By default, it renders from Monday to Friday (5 days).

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData"  CurrentView="WorkWeek" WorkWeek="Monday,Tuesday,Thursday,Friday,Saturday" CurrentDate="5/2/2014">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    Month

    Month view displays the entire days of a particular month and all its related appointments. An alternative way to navigate to a particular date in a day view directly from Month view, clicking on the appropriate month cell date header will do so. If the week date range column is clicked, it will navigate to the corresponding week view.

    The next and previous month date cells in the Month view can be shown/hidden on the Scheduler using ShowNextPrevMonth property by setting it to false.

    For example – To set the Month view as current view in Scheduler and to hide the other month days in it, refer the below code example.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData"  CurrentView="Month" CurrentDate="5/2/2014" ShowNextPrevMonth ="false">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    NOTE

    An appointment directly created in Month view will be considered as an all-day appointment.

    Customizing Number of days (Custom View)

    The Scheduler can be displayed with the user-specified date ranges, such as 4 days or any specific date ranges instead of default view options, by making use of the RenderDates property. This property includes two sub properties namely Start and End, which accepts the date object or date value in string format to specify the date range.

    To display the custom view option in the toolbar-like view options in the scheduler header area, add the CustomView value to the views property array collection as shown below.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" Views="Day,Week,WorkWeek,Month,CustomView" CurrentView="CustomView" CurrentDate="5/2/2014">
        <RenderDates Start="5/2/2014" End="5/8/2014"/>
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    Agenda

    This View option lists out the appointments in a grid-like view for the next 7 days by default from the current date. The count of the number of appointments to be listed in this view can be customized using the AgendaViewSettings.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" CurrentView="Agenda" CurrentDate="5/2/2014">
        <AgendaViewSettings DaysInAgenda="5" />
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    NOTE

    In Agenda view, the templates can be applied for the date and time columns which can be referred here. Also, the template passed through the AppointmentTemplateID will gets applied to the event column in Agenda view.

    Restriction on View Navigation

    It is possible to restrict the users to display only the specific list of views in the Schedule header section and also not to navigate to other views that are not listed.

    For example, if the views property is set only with Month view – then the Schedule header section displays only the Month option in the view toolbar and also other additional available actions like navigating to day/week view on clicking the month header dates and week date-range is stopped.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" Views="Month" CurrentView="Month" CurrentDate="5/2/2014">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>

    NOTE

    Even though Week view is the active view in Scheduler by default, if it is not listed in the views collection – then the first listed option in the views collection will be taken as current view of the Scheduler.

    Timeline View

    Timeline view displays the day, time and its associated events horizontally arranged from left to right. By default, Scheduler renders in vertical mode and it can be changed to the timeline mode using Orientation property which accepts both the string and ej.Schedule.Orientation enum value.

    All the applicable features in Vertical mode works similar with Timeline mode (Horizontal) and only the visualization of the layout changes based on the orientation.

  • HTML
  • <!--Container for ejScheduler widget-->
    <ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" Orientation="Horizontal" CurrentDate="5/2/2014">
        <AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule"/>
    </ej:Schedule>
    
    <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
                SelectCommand="SELECT * FROM [DefaultSchedule]"></asp:SqlDataSource>