<dx-scheduler
timeZone="America/Los_Angeles"
[dataSource]="appointmentsData"
[views]="['workWeek']"
currentView="workWeek"
[currentDate]="currentDate"
[startDayHour]="9"
[endDayHour]="19"
[height]="600"
>
<dxi-scheduler-resource
fieldExpr="roomId"
label="Room"
[dataSource]="rooms"
[useColorAsDefault]="currentResource === 'Room'"
icon="conferenceroomoutline"
>
</dxi-scheduler-resource>
<dxi-scheduler-resource
fieldExpr="priorityId"
label="Priority"
[dataSource]="priorities"
[useColorAsDefault]="currentResource === 'Priority'"
icon="tags"
>
</dxi-scheduler-resource>
<dxi-scheduler-resource
fieldExpr="assigneeId"
label="Assignee"
[allowMultiple]="true"
[dataSource]="assignees"
[useColorAsDefault]="currentResource === 'Assignee'"
icon="user"
>
</dxi-scheduler-resource>
<dxo-scheduler-editing>
<dxo-scheduler-form>
<dxi-scheduler-item name="mainGroup">
<dxi-scheduler-item name="subjectGroup"></dxi-scheduler-item>
<dxi-scheduler-item name="dateGroup"></dxi-scheduler-item>
<dxi-scheduler-item name="repeatGroup"></dxi-scheduler-item>
<dxi-scheduler-item name="resourcesGroup">
<dxi-scheduler-item
name="roomIdGroup"
[colCount]="3"
[colCountByScreen]="{ xs: 3 }"
>
<dxi-scheduler-item name="roomIdIcon"></dxi-scheduler-item>
<dxi-scheduler-item name="roomIdEditor"></dxi-scheduler-item>
<dxi-scheduler-item name="priorityIdEditor"></dxi-scheduler-item>
</dxi-scheduler-item>
<dxi-scheduler-item name="assigneeIdGroup"></dxi-scheduler-item>
</dxi-scheduler-item>
<dxi-scheduler-item name="descriptionGroup"></dxi-scheduler-item>
</dxi-scheduler-item>
<dxi-scheduler-item name="recurrenceGroup"></dxi-scheduler-item>
</dxo-scheduler-form>
</dxo-scheduler-editing>
</dx-scheduler>
<div class="options">
<div class="caption">Use colors of:</div>
<div class="option">
<dx-radio-group
[items]="resourcesList"
[(value)]="currentResource"
layout="horizontal"
>
</dx-radio-group>
</div>
</div>
import { bootstrapApplication } from '@angular/platform-browser';
import { Component, enableProdMode, provideZoneChangeDetection } from '@angular/core';
import { DxSchedulerModule, DxRadioGroupModule } from 'devextreme-angular';
import {
Appointment, Service, Assignee, Room, Priority,
} from './app.service';
if (!/localhost/.test(document.location.host)) {
enableProdMode();
}
@Component({
selector: 'demo-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [Service],
preserveWhitespaces: true,
imports: [
DxSchedulerModule,
DxRadioGroupModule,
],
})
export class AppComponent {
appointmentsData: Appointment[];
assignees: Assignee[];
rooms: Room[];
priorities: Priority[];
resourcesList: string[] = ['Assignee', 'Room', 'Priority'];
currentDate: Date = new Date(2021, 3, 27);
currentResource: string = this.resourcesList[0];
constructor(service: Service) {
this.appointmentsData = service.getAppointments();
this.assignees = service.getAssignees();
this.rooms = service.getRooms();
this.priorities = service.getPriorities();
}
}
bootstrapApplication(AppComponent, {
providers: [
provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }),
],
});
.options {
padding: 20px;
background-color: rgba(191, 191, 191, 0.15);
margin-top: 20px;
}
.caption {
font-size: 18px;
font-weight: 500;
}
.option {
margin-top: 10px;
display: inline-block;
}
import { Injectable } from '@angular/core';
export class Appointment {
text: string;
startDate: Date;
endDate: Date;
allDay?: boolean;
assigneeId: number[];
roomId: number;
priorityId: number;
}
export class Assignee {
text: string;
id: number;
color: string;
}
export class Room {
text: string;
id: number;
color: string;
}
export class Priority {
text: string;
id: number;
color: string;
}
const appointments: Appointment[] = [
{
text: 'Website Re-Design Plan',
assigneeId: [4],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-26T16:30:00.000Z'),
endDate: new Date('2021-04-26T18:30:00.000Z'),
}, {
text: 'Book Flights to San Fran for Sales Trip',
assigneeId: [2],
roomId: 2,
priorityId: 1,
startDate: new Date('2021-04-26T19:00:00.000Z'),
endDate: new Date('2021-04-26T20:00:00.000Z'),
allDay: true,
}, {
text: 'Install New Router in Dev Room',
assigneeId: [1],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-26T21:30:00.000Z'),
endDate: new Date('2021-04-26T22:30:00.000Z'),
}, {
text: 'Approve Personal Computer Upgrade Plan',
assigneeId: [3],
roomId: 2,
priorityId: 2,
startDate: new Date('2021-04-27T17:00:00.000Z'),
endDate: new Date('2021-04-27T18:00:00.000Z'),
}, {
text: 'Final Budget Review',
assigneeId: [1],
roomId: 1,
priorityId: 1,
startDate: new Date('2021-04-27T19:00:00.000Z'),
endDate: new Date('2021-04-27T20:35:00.000Z'),
}, {
text: 'New Brochures',
assigneeId: [4],
roomId: 3,
priorityId: 2,
startDate: new Date('2021-04-27T21:30:00.000Z'),
endDate: new Date('2021-04-27T22:45:00.000Z'),
}, {
text: 'Install New Database',
assigneeId: [2],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-28T16:45:00.000Z'),
endDate: new Date('2021-04-28T18:15:00.000Z'),
}, {
text: 'Approve New Online Marketing Strategy',
assigneeId: [4],
roomId: 2,
priorityId: 1,
startDate: new Date('2021-04-28T19:00:00.000Z'),
endDate: new Date('2021-04-28T21:00:00.000Z'),
}, {
text: 'Upgrade Personal Computers',
assigneeId: [2],
roomId: 2,
priorityId: 2,
startDate: new Date('2021-04-28T22:15:00.000Z'),
endDate: new Date('2021-04-28T23:30:00.000Z'),
}, {
text: 'Customer Workshop',
assigneeId: [3],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-29T18:00:00.000Z'),
endDate: new Date('2021-04-29T19:00:00.000Z'),
allDay: true,
}, {
text: 'Prepare 2021 Marketing Plan',
assigneeId: [1],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-29T18:00:00.000Z'),
endDate: new Date('2021-04-29T20:30:00.000Z'),
}, {
text: 'Brochure Design Review',
assigneeId: [4],
roomId: 1,
priorityId: 1,
startDate: new Date('2021-04-29T21:00:00.000Z'),
endDate: new Date('2021-04-29T22:30:00.000Z'),
}, {
text: 'Create Icons for Website',
assigneeId: [3],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-30T17:00:00.000Z'),
endDate: new Date('2021-04-30T18:30:00.000Z'),
}, {
text: 'Upgrade Server Hardware',
assigneeId: [4],
roomId: 2,
priorityId: 2,
startDate: new Date('2021-04-30T21:30:00.000Z'),
endDate: new Date('2021-04-30T23:00:00.000Z'),
}, {
text: 'Submit New Website Design',
assigneeId: [1],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-30T23:30:00.000Z'),
endDate: new Date('2021-05-01T01:00:00.000Z'),
}, {
text: 'Launch New Website',
assigneeId: [2],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-30T19:20:00.000Z'),
endDate: new Date('2021-04-30T21:00:00.000Z'),
},
];
const assignees: Assignee[] = [
{
text: 'Samantha Bright',
id: 1,
color: '#C2185B',
}, {
text: 'John Heart',
id: 2,
color: '#1564C0',
}, {
text: 'Todd Hoffman',
id: 3,
color: '#2E7D32',
}, {
text: 'Sandra Johnson',
id: 4,
color: '#7B1FA2',
},
];
const rooms: Room[] = [
{
text: 'Room 1',
id: 1,
color: '#00af2c',
}, {
text: 'Room 2',
id: 2,
color: '#2E7D32',
}, {
text: 'Room 3',
id: 3,
color: '#8ecd3c',
},
];
const priorities: Priority[] = [
{
text: 'High',
id: 1,
color: '#C62828',
}, {
text: 'Low',
id: 2,
color: '#DD2C00',
},
];
@Injectable()
export class Service {
getAppointments(): Appointment[] {
return appointments;
}
getAssignees(): Assignee[] {
return assignees;
}
getRooms(): Room[] {
return rooms;
}
getPriorities(): Priority[] {
return priorities;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" />
</head>
<body class="dx-viewport">
<div class="demo-container">
<demo-app>Loading...</demo-app>
</div>
<script src="https://cdn.jsdelivr.net/npm/zone.js@0.16.2/bundles/zone.umd.js"></script>
<script src="./bundle.js" type="module"></script>
</body>
</html>