Row Auto Height in React Scheduler
By default, the height of Scheduler rows in Timeline views is static. When multiple appointments overlap in the same time range, a +n more indicator is displayed. With row auto height enabled, the Scheduler adjusts the row height based on the number of appointments so that overlapping events are visible without using the +n more indicator.
To enable auto row height adjustments in Timeline views and the Month view, set the rowAutoHeight property to true (default is false).
Note: This feature applies only to Timeline views and the calendar Month view.
The following sections show how the feature works in the supported views.
Tip: Use row auto height when you want to reduce hidden appointments in dense schedules.
Calendar month view
By default, the rows in the calendar Month view can hold only a limited number of appointments based on their height, and the remaining overlapping appointments are indicated with a +n more text. The following example shows how the Month view row adjusts automatically based on the number of appointments when the rowAutoHeight feature is enabled.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ScheduleComponent, Month, Inject, ViewsDirective, ViewDirective } from '@syncfusion/ej2-react-schedule';
import { scheduleData } from './datasource';
const App = () => {
const eventSettings = { dataSource: scheduleData };
return (<ScheduleComponent width='100%' height='550px' selectedDate={new Date(2018, 1, 15)} eventSettings={eventSettings} rowAutoHeight={true}>
<ViewsDirective>
<ViewDirective option='Month' />
</ViewsDirective>
<Inject services={[Month]} />
</ScheduleComponent>);
}
;
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
ScheduleComponent, Month, Inject,
ViewsDirective, ViewDirective, EventSettingsModel
} from '@syncfusion/ej2-react-schedule';
import { scheduleData } from './datasource';
const App = () => {
const eventSettings: EventSettingsModel = { dataSource: scheduleData };
return (<ScheduleComponent width='100%' height='550px' selectedDate={new Date(2018, 1, 15)} eventSettings={eventSettings} rowAutoHeight={true}>
<ViewsDirective>
<ViewDirective option='Month' />
</ViewsDirective>
<Inject services={[Month]} />
</ScheduleComponent>)
};
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Schedule</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-base/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-buttons/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-calendars/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-dropdowns/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-inputs/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-navigations/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-popups/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-schedule/styles/tailwind3.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='schedule'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>Timeline views
When the rowAutoHeight feature is enabled in Timeline views, the row height adjusts automatically based on the number of overlapping events in the same time range, as shown in the following example.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ScheduleComponent, TimelineViews, Inject, TimelineMonth, Agenda, ViewsDirective, ViewDirective } from '@syncfusion/ej2-react-schedule';
import { scheduleData } from './datasource';
const App = () => {
const eventSettings = { dataSource: scheduleData };
return (<ScheduleComponent width='100%' height='550px' selectedDate={new Date(2018, 1, 15)} eventSettings={eventSettings} rowAutoHeight={true}>
<ViewsDirective>
<ViewDirective option='TimelineDay' />
<ViewDirective option='TimelineWeek' />
<ViewDirective option='TimelineWorkWeek' />
<ViewDirective option='TimelineMonth' />
<ViewDirective option='Agenda' />
</ViewsDirective>
<Inject services={[TimelineViews, TimelineMonth, Agenda]} />
</ScheduleComponent>);
}
;
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
ScheduleComponent, TimelineViews, Inject, TimelineMonth, Agenda,
ViewsDirective, ViewDirective, EventSettingsModel
} from '@syncfusion/ej2-react-schedule';
import { scheduleData } from './datasource';
const App = () => {
const eventSettings: EventSettingsModel = { dataSource: scheduleData };
return (<ScheduleComponent width='100%' height='550px' selectedDate={new Date(2018, 1, 15)} eventSettings={eventSettings} rowAutoHeight={true}>
<ViewsDirective>
<ViewDirective option='TimelineDay' />
<ViewDirective option='TimelineWeek' />
<ViewDirective option='TimelineWorkWeek' />
<ViewDirective option='TimelineMonth' />
<ViewDirective option='Agenda' />
</ViewsDirective>
<Inject services={[TimelineViews, TimelineMonth, Agenda]} />
</ScheduleComponent>)
};
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Schedule</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-base/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-buttons/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-calendars/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-dropdowns/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-inputs/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-navigations/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-popups/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-schedule/styles/tailwind3.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='schedule'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>Timeline views with multiple resources
The following example shows how the auto row height feature works in Timeline views with multiple resources.
Tip: This is useful when each resource contains several overlapping appointments in the same time slot.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { TimelineViews, ScheduleComponent, ViewsDirective, ViewDirective, ResourcesDirective, ResourceDirective, Inject, Resize, DragAndDrop } from '@syncfusion/ej2-react-schedule';
import { roomData } from './datasource';
const App = () => {
const ownerData = [
{ text: 'Room A', id: 1, color: '#98AFC7' },
{ text: 'Room B', id: 2, color: '#99c68e' },
{ text: 'Room C', id: 3, color: '#C2B280' },
{ text: 'Room D', id: 4, color: '#3090C7' },
{ text: 'Room E', id: 5, color: '#95b9' },
{ text: 'Room F', id: 6, color: '#95b9c7' },
{ text: 'Room G', id: 7, color: '#deb887' },
{ text: 'Room H', id: 8, color: '#3090C7' },
{ text: 'Room I', id: 9, color: '#98AFC7' },
{ text: 'Room J', id: 10, color: '#778899' }
];
const fieldsData = {
id: 'Id',
subject: { title: 'Summary', name: 'Subject' },
location: { title: 'Location', name: 'Location' },
description: { title: 'Comments', name: 'Description' },
startTime: { title: 'From', name: 'StartTime' },
endTime: { title: 'To', name: 'EndTime' }
}
const eventSettings = { dataSource: roomData, fields: fieldsData };
const group = { enableCompactView: false, resources: ['MeetingRoom'] };
return (<ScheduleComponent width='100%' height='550px' selectedDate={new Date(2018, 7, 1)} rowAutoHeight={true} eventSettings={eventSettings} group={group}>
<ResourcesDirective>
<ResourceDirective field='RoomId' title='Room Type' name='MeetingRoom' allowMultiple={true} dataSource={ownerData} textField='text' idField='id' colorField='color'>
</ResourceDirective></ResourcesDirective>
<ViewsDirective>
<ViewDirective option='TimelineDay' />
<ViewDirective option='TimelineWeek' />
</ViewsDirective>
<Inject services={[TimelineViews, Resize, DragAndDrop]} />
</ScheduleComponent>);
}
;
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);import * as ReactDOM from 'react-dom';
import * as React from 'react';
import {
TimelineViews, ScheduleComponent, ViewsDirective,
ViewDirective, ResourcesDirective, ResourceDirective, Inject, Resize, DragAndDrop, EventSettingsModel, GroupModel
} from '@syncfusion/ej2-react-schedule';
import { roomData } from './datasource';
const App = () => {
const ownerData: Object[] = [
{ text: 'Room A', id: 1, color: '#98AFC7' },
{ text: 'Room B', id: 2, color: '#99c68e' },
{ text: 'Room C', id: 3, color: '#C2B280' },
{ text: 'Room D', id: 4, color: '#3090C7' },
{ text: 'Room E', id: 5, color: '#95b9' },
{ text: 'Room F', id: 6, color: '#95b9c7' },
{ text: 'Room G', id: 7, color: '#deb887' },
{ text: 'Room H', id: 8, color: '#3090C7' },
{ text: 'Room I', id: 9, color: '#98AFC7' },
{ text: 'Room J', id: 10, color: '#778899' }
];
const fieldsData = {
id: 'Id',
subject: { title: 'Summary', name: 'Subject' },
location: { title: 'Location', name: 'Location' },
description: { title: 'Comments', name: 'Description' },
startTime: { title: 'From', name: 'StartTime' },
endTime: { title: 'To', name: 'EndTime' }
}
const eventSettings: EventSettingsModel = { dataSource: roomData, fields: fieldsData };
const group: GroupModel = { enableCompactView: false, resources: ['MeetingRoom'] };
return (<ScheduleComponent width='100%' height='550px' selectedDate={new Date(2018, 7, 1)} rowAutoHeight={true} eventSettings={eventSettings} group={group} >
<ResourcesDirective>
<ResourceDirective field='RoomId' title='Room Type' name='MeetingRoom' allowMultiple={true}
dataSource={ownerData} textField='text' idField='id' colorField='color'>
</ResourceDirective></ResourcesDirective>
<ViewsDirective>
<ViewDirective option='TimelineDay' />
<ViewDirective option='TimelineWeek' />
</ViewsDirective>
<Inject services={[TimelineViews, Resize, DragAndDrop]} />
</ScheduleComponent>)
};
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Schedule</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-base/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-buttons/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-calendars/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-dropdowns/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-inputs/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-navigations/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-popups/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-schedule/styles/tailwind3.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='schedule'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>Appointments occupying entire cell
When rowAutoHeight is enabled, a small space may appear at the bottom of the cell after an appointment is rendered. To remove this extra space, set the ignoreWhitespace property to true in eventSettings. The default value is false. The following example shows the whitespace below appointments removed.
Note: The
ignoreWhitespaceproperty applies only whenrowAutoHeightis enabled.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { TimelineViews, TimelineMonth, ScheduleComponent, ViewsDirective, ViewDirective, ResourcesDirective, ResourceDirective, Inject } from '@syncfusion/ej2-react-schedule';
import { resourceData } from './datasource';
const App = () => {
const eventSettings = { dataSource: resourceData, ignoreWhitespace: true };
const group = { resources: ['Rooms', 'Owners'] };
const roomData = [
{ RoomText: 'ROOM 1', Id: 1, RoomColor: '#cb6bb2' },
{ RoomText: 'ROOM 2', Id: 2, RoomColor: '#56ca85' }
];
const ownerData = [
{ OwnerText: 'Nancy', Id: 1, GroupId: 1, OwnerColor: '#ffaa00' },
{ OwnerText: 'Steven', Id: 2, GroupId: 2, OwnerColor: '#f8a398' },
{ OwnerText: 'Michael', Id: 3, GroupId: 1, OwnerColor: '#7499e1' }
];
return (<ScheduleComponent width='100%' height='550px' currentView='TimelineWeek' rowAutoHeight={true} selectedDate={new Date(2021, 7, 4)} eventSettings={eventSettings} group={group}>
<ViewsDirective>
<ViewDirective option='TimelineDay' />
<ViewDirective option='TimelineWeek' />
<ViewDirective option='TimelineMonth' />
</ViewsDirective>
<ResourcesDirective>
<ResourceDirective field='RoomId' title='Room' name='Rooms' dataSource={roomData} textField='RoomText' idField='Id' colorField='RoomColor'>
</ResourceDirective>
<ResourceDirective field='OwnerId' title='Owner' name='Owners' allowMultiple={true} dataSource={ownerData} textField='OwnerText' idField='Id' groupIDField='GroupId' colorField='OwnerColor'>
</ResourceDirective>
</ResourcesDirective>
<Inject services={[TimelineViews, TimelineMonth]} />
</ScheduleComponent>);
}
;
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
TimelineViews, TimelineMonth, ScheduleComponent, ViewsDirective, ViewDirective, EventSettingsModel, GroupModel,
ResourcesDirective, ResourceDirective, Inject
} from '@syncfusion/ej2-react-schedule';
import { resourceData } from './datasource';
const App = () => {
const eventSettings: EventSettingsModel = { dataSource: resourceData, ignoreWhitespace: true };
const group: GroupModel = { resources: ['Rooms', 'Owners'] };
const roomData: Object[] = [
{ RoomText: 'ROOM 1', Id: 1, RoomColor: '#cb6bb2' },
{ RoomText: 'ROOM 2', Id: 2, RoomColor: '#56ca85' }
]
const ownerData: Object[] = [
{ OwnerText: 'Nancy', Id: 1, GroupId: 1, OwnerColor: '#ffaa00' },
{ OwnerText: 'Steven', Id: 2, GroupId: 2, OwnerColor: '#f8a398' },
{ OwnerText: 'Michael', Id: 3, GroupId: 1, OwnerColor: '#7499e1' }
];
return (<ScheduleComponent width='100%' height='550px' currentView='TimelineWeek' rowAutoHeight={true} selectedDate={new Date(2021, 7, 4)} eventSettings={eventSettings} group={group}>
<ViewsDirective>
<ViewDirective option='TimelineDay' />
<ViewDirective option='TimelineWeek' />
<ViewDirective option='TimelineMonth' />
</ViewsDirective>
<ResourcesDirective>
<ResourceDirective field='RoomId' title='Room' name='Rooms'
dataSource={roomData} textField='RoomText' idField='Id' colorField='RoomColor'>
</ResourceDirective>
<ResourceDirective field='OwnerId' title='Owner' name='Owners' allowMultiple={true}
dataSource={ownerData} textField='OwnerText' idField='Id' groupIDField='GroupId' colorField='OwnerColor'>
</ResourceDirective>
</ResourcesDirective>
<Inject services={[TimelineViews, TimelineMonth]} />
</ScheduleComponent>)
};
const root = ReactDOM.createRoot(document.getElementById('schedule'));
root.render(<App />);<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Schedule</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-base/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-buttons/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-calendars/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-dropdowns/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-inputs/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-navigations/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-popups/styles/tailwind3.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/34.2.2/ej2-react-schedule/styles/tailwind3.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='schedule'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>Note: The ignoreWhitespace property applies only when the rowAutoHeight feature is enabled in the Scheduler.
See also
- Syncfusion React Scheduler - Component homepage
- Scheduler API Reference - Complete API documentation
- Live Examples - Interactive Scheduler demos