通过设置Kendo Scheduler的事件重叠解决重叠问题。可以使用“views”属性“week”视图的“eventOverlap”属性将事件重叠设置为“false”或使用“views”属性“agenda”视图的“eventMargin”属性将事件之间的间距调整为合适的大小。
代码示例:
@(Html.Kendo().Scheduler()
.Name("scheduler")
.Date(DateTime.Now)
.Views(views => {
views.WeekView();
views.AgendaView();
})
.DataSource(d => d.Model(m => {
m.Id(f => f.Id);
m.Field(f => f.Title).DefaultValue("No title");
})
.Read("Tasks_Read", "Scheduler")
.Create("Tasks_Create", "Scheduler")
.Update("Tasks_Update", "Scheduler")
.Destroy("Tasks_Destroy", "Scheduler"))
.Events(e => {
e.Edit("scheduler_edit");
e.Move("scheduler_move");
e.Resize("scheduler_resize");
})
.EventTemplateId("event-template")
.Group(group => group.Resources("Rooms"))
.Resources(resource =>
{
resource.Add(m => m.RoomId)
.Title("Room")
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source => source.Read("Rooms_Read", "Scheduler"));
})
.Views(views =>
{
views.WeekView(e => e.EventOverlap(false));
views.AgendaView(e => e.EventMargin(7));
})
)