@(Html.DevExtreme().Scheduler()
.Height(600)
.Views(views =>
{
views.Add()
.Name("2 Days")
.Type(SchedulerViewType.Day)
.GroupOrientation(Orientation.Vertical)
.IntervalCount(2);
views.Add()
.Name("3 Days")
.Type(SchedulerViewType.Day)
.GroupOrientation(Orientation.Vertical)
.IntervalCount(3);
views.Add()
.Name("Work Week")
.Type(SchedulerViewType.Day)
.GroupOrientation(Orientation.Vertical);
})
.ElementAttr("class", "scheduler")
.StartDayHour(9)
.EndDayHour(18)
.CurrentView("3 Days")
.Scrolling(config => { config.Mode(SchedulerScrollingMode.Virtual); })
.ShowAllDayPanel(false)
.Groups(new[] { "resourceId" })
.CurrentDate(new DateTime(2021, 9, 6))
)
<script>
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;
}
function getScheduler() {
return $(".scheduler").dxScheduler("instance");
}
$(function () {
const scheduler = getScheduler();
scheduler.option("dataSource", generateAppointments());
scheduler.option("resources", [{
fieldExpr: "resourceId",
dataSource: generateResources()
}]);
})
</script>
using DevExtreme.MVC.Demos.Models.SampleData;
using DevExtreme.MVC.Demos.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace DevExtreme.MVC.Demos.Controllers {
public class SchedulerController : Controller {
public ActionResult VirtualScrolling() {
return View();
}
}
}