$(function () {
var resources = generateResources();
var appointments = generateAppointments();
$("#scheduler").dxScheduler({
height: 600,
dataSource: appointments,
views: [{
type: 'day',
groupOrientation: 'vertical',
name: '2 Days',
intervalCount: 2
}, {
type: 'day',
groupOrientation: 'vertical',
name: '3 Days',
intervalCount: 3
}, {
type: "workWeek",
name: 'Work Week',
groupOrientation: "vertical"
}],
startDayHour: 9,
endDayHour: 18,
currentView: "3 Days",
scrolling: {
mode: 'virtual'
},
showAllDayPanel: false,
currentDate: new Date(2021, 8, 6),
groups: ["resourceId"],
resources: [{
fieldExpr: "resourceId",
dataSource: resources
}]
});
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<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=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.2.5/css/dx.common.css" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.2.5/css/dx.light.css" />
<script src="https://cdn3.devexpress.com/jslib/20.2.5/js/dx.all.js"></script>
<script src="data.js"></script>
<script src="index.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="scheduler"></div>
</div>
</body>
</html>
var resourcesAmount = 100;
var colors = [
'rgba(88, 116, 255, 0.8)',
'rgba(234, 128, 252, 0.8)',
'rgba(198, 86, 144, 0.85)',
'rgba(254, 194, 0, 0.7)'
];
var dataSet = [{
text: "Website Re-Design Plan",
startDate: new Date(2021, 8, 6, 9, 30),
endDate: new Date(2021, 8, 6, 11, 30)
}, {
text: "Book Flights to San Fran for Sales Trip",
startDate: new Date(2021, 8, 6, 12, 0),
endDate: new Date(2021, 8, 6, 13, 0),
allDay: true
}, {
text: "Install New Router in Dev Room",
startDate: new Date(2021, 8, 6, 14, 30),
endDate: new Date(2021, 8, 6, 15, 30)
}, {
text: "Approve Personal Computer Upgrade Plan",
startDate: new Date(2021, 8, 7, 10, 0),
endDate: new Date(2021, 8, 7, 11, 0)
}, {
text: "Final Budget Review",
startDate: new Date(2021, 8, 7, 12, 0),
endDate: new Date(2021, 8, 7, 13, 35)
}, {
text: "New Brochures",
startDate: new Date(2021, 8, 7, 14, 30),
endDate: new Date(2021, 8, 7, 15, 45)
}, {
text: "Install New Database",
startDate: new Date(2021, 8, 8, 9, 45),
endDate: new Date(2021, 8, 8, 11, 15)
}, {
text: "Approve New Online Marketing Strategy",
startDate: new Date(2021, 8, 8, 12, 0),
endDate: new Date(2021, 8, 8, 14, 0)
}, {
text: "Upgrade Personal Computers",
startDate: new Date(2021, 8, 8, 15, 15),
endDate: new Date(2021, 8, 8, 16, 30)
}, {
text: "Customer Workshop",
startDate: new Date(2021, 8, 9, 11, 0),
endDate: new Date(2021, 8, 9, 12, 0),
allDay: true
}, {
text: "Prepare 2015 Marketing Plan",
startDate: new Date(2021, 8, 9, 11, 0),
endDate: new Date(2021, 8, 9, 13, 30)
}, {
text: "Brochure Design Review",
startDate: new Date(2021, 8, 9, 14, 0),
endDate: new Date(2021, 8, 9, 15, 30)
}, {
text: "Create Icons for Website",
startDate: new Date(2021, 8, 10, 10, 0),
endDate: new Date(2021, 8, 10, 11, 30)
}, {
text: "Upgrade Server Hardware",
startDate: new Date(2021, 8, 10, 14, 30),
endDate: new Date(2021, 8, 10, 16, 0)
}, {
text: "Submit New Website Design",
startDate: new Date(2021, 8, 10, 16, 30),
endDate: new Date(2021, 8, 10, 18, 0)
}, {
text: "Launch New Website",
startDate: new Date(2021, 8, 10, 12, 20),
endDate: new Date(2021, 8, 10, 14, 0)
}
];
function generateResources() {
var resources = [];
for(var i = 0; i < resourcesAmount; ++i) {
var color = colors[i % colors.length];
resources.push({
id: i,
text: `Resource ${i}`,
color: color
});
}
return resources;
};
function generateAppointments() {
var data = [];
for(var resourceId = 0; resourceId < resourcesAmount; ++resourceId) {
dataSet.forEach(function(item) {
data.push({
text: item.text,
startDate: item.startDate,
endDate: item.endDate,
resourceId
});
});
}
return data;
}