Setting Dimension
28 May 20196 minutes to read
The dimension normally refers to the height and width of the element. With Scheduler, it is possible to set 2 kinds of dimensions.
- Scheduler dimension (Scheduler control height and width)
- Cell dimension (Scheduler cells height and width)
Scheduler Dimension
The Height
and Width
properties can be defined to set the outer dimension of the Scheduler control.
<!--Container for ejScheduler widget-->
<<ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" Width="70%" Height="500px" 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
The height and width properties accepts both pixel and percentage values.
Scheduler Cell Dimensions
Cell Height
The CellHeight
property allows the Scheduler to set the height of the cells in pixels. The appointment height in vertical mode changes accordingly as per the cell size within which it renders.
<!--Container for ejScheduler widget-->
<ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" CellHeight="40px" 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
In desktop mode, the default height value of the cells is set to 20px, whereas for mobile mode – the Scheduler cells are rendered with 40px by default.
Cell Auto-Height
The height of the cells specifically in timeline view can be made to adjust automatically based on its exceeding appointment count. It is controlled by an API named ShowOverflowButton
which accepts true or false value, denoting whether to enable/disable the cell auto-height adjusting option. To enable this option, set the value of ShowOverflowButton
as false
whereas its default value is true
.
In Vertical view, the same functionality is made applicable only in the Month View whereas in Horizontal mode, it is applicable in all the views.
<ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" Width="100%" Height="525px" CellWidth="40px" CurrentDate="5/5/2014" Orientation="Horizontal" Views="Week,WorkWeek,Month,Agenda" CurrentView="Month" ShowCurrentTimeIndicator="false" ShowOverflowButton="false">
<Group Resources="Owners" />
<Resources>
<ej:Resources Field="OwnerId" Name="Owners" Title="Owner" AllowMultiple="true">
<ResourceSettings Color="color" Id="id" Text="text">
</ResourceSettings>
</ej:Resources>
</Resources>
<AppointmentSettings Id="Id" Subject="Subject" AllDay="AllDay" StartTime="StartTime" EndTime="EndTime" Description="Description" Recurrence="Recurrence" RecurrenceRule="RecurrenceRule" ResourceFields="OwnerId"/>
</ej:Schedule>
<asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"
SelectCommand="SELECT * FROM [MultipleResource]"></asp:SqlDataSource>
namespace WebSampleBrowser.Schedule
{
public partial class CellAutoFit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<Rooms> owners = new List<Rooms>();
owners.Add(new Rooms { text = "Nancy", id = "1", color = "#f8a398" });
owners.Add(new Rooms { text = "Steven", id = "3", color = "#56ca85" });
owners.Add(new Rooms { text = "Michael", id = "5", color = "#51a0ed" });
Schedule1.Resources[0].ResourceSettings.DataSource = owners;
}
public class Rooms
{
public string text { set; get; }
public string id { set; get; }
public string groupId { set; get; }
public string color { set; get; }
}
}
}
Cell Width
The CellWidth
property allows the Scheduler to set the width of the cells in pixels. The appointment width adjusts based on the cell width of the Scheduler.
<!--Container for ejScheduler widget-->
<ej:Schedule ClientIDMode="Static" runat="server" ID="Schedule1" DataSourceID="SqlData" CellWidth="97px" 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
When the CellHeight and CellWidth properties are set with some specific pixel values, the cell size does not adapt to the responsive behavior of the Scheduler while resizing it in desktop/mobile mode.