syncfusion-aspnetcore-scheduler
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing ASP.NET Core Scheduler
实现ASP.NET Core Scheduler
The Syncfusion ASP.NET Core Scheduler is a comprehensive component for managing appointments, events, and schedules. It provides rich functionality for creating calendar-based applications with support for multiple views, resources, recurring events, and extensive customization options.
Syncfusion ASP.NET Core Scheduler是一款功能全面的组件,用于管理预约、事件和日程安排。它提供了丰富的功能,可用于构建基于日历的应用,支持多视图、资源、重复事件和大量自定义选项。
When to Use This Skill
何时使用此技能
- Appointment Management: Creating, editing, and deleting calendar appointments
- Multi-User Scheduling: Implementing resource scheduling for multiple users or resources
- Calendar Views: Displaying events in day, week, month, timeline, or agenda formats
- Recurring Events: Managing repeating appointments with complex recurrence rules
- Data Integration: Binding local or remote data sources to the Scheduler
- Custom Templates: Customizing event appearance and templates
- Working Hours: Configuring business hours, working days, and timezones
- Event Operations: Drag-and-drop rescheduling, resizing, and inline editing
- 预约管理: 创建、编辑和删除日历预约
- 多用户调度: 为多个用户或资源实现资源调度功能
- 日历视图: 以日、周、月、时间线或议程格式展示事件
- 重复事件: 管理带有复杂重复规则的周期性预约
- 数据集成: 将本地或远程数据源绑定到Scheduler
- 自定义模板: 自定义事件外观和模板
- 工作时间: 配置营业时间、工作日和时区
- 事件操作: 拖放重调度、大小调整和行内编辑
Documentation and Navigation Guide
文档和导航指南
Getting Started
快速入门
📄 Read: references/getting-started.md
- Installation and NuGet package setup
- Adding Tag Helper and script resources
- Registering Script Manager
- Basic Scheduler initialization
- Populating appointments and setting default date/view
📄 阅读: references/getting-started.md
- 安装和NuGet包设置
- 添加Tag Helper和脚本资源
- 注册Script Manager
- 基础Scheduler初始化
- 填充预约数据并设置默认日期/视图
Appointment Management
预约管理
📄 Read: references/appointments.md
- Appointment data structure and field mapping
- Creating normal, all-day, spanned, and recurring events
- Appointment properties (Id, Subject, StartTime, EndTime, Location, Description)
- Recurring appointments and recurrence rules
- Exception handling for recurring events
- Drag-and-drop and inline editing
📄 阅读: references/appointments.md
- 预约数据结构和字段映射
- 创建普通、全天、跨天和重复事件
- 预约属性(Id、Subject、StartTime、EndTime、Location、Description)
- 重复预约和重复规则
- 重复事件的异常处理
- 拖放和行内编辑
CRUD Operations
CRUD操作
📄 Read: references/crud-operations.md
- Adding appointments (editor window, addEvent method, server-side insertion)
- Editing appointments (saveEvent method, normal and recurring events)
- Deleting appointments (deleteEvent method, handling series vs occurrences)
- Handling conflicts and validation
- Server-side database operations
- Batch operations for multiple changes
📄 阅读: references/crud-operations.md
- 添加预约(编辑器窗口、addEvent方法、服务端插入)
- 编辑预约(saveEvent方法、普通和重复事件)
- 删除预约(deleteEvent方法、处理系列和单次事件)
- 冲突处理和校验
- 服务端数据库操作
- 多变更批量操作
Views and Configuration
视图和配置
📄 Read: references/views-and-modes.md
- Available view types (Day, Week, WorkWeek, Month, Year, Agenda, MonthAgenda, Timeline views)
- Setting currentView and switching between views
- View-specific configurations using e-schedule-views
- Customizing start/end hours, working days, timescales
- Date format and weekend display settings
📄 阅读: references/views-and-modes.md
- 可用视图类型(Day、Week、WorkWeek、Month、Year、Agenda、MonthAgenda、Timeline视图)
- 设置currentView和视图切换
- 使用e-schedule-views配置视图专属参数
- 自定义开始/结束时间、工作日、时间刻度
- 日期格式和周末展示设置
Scheduling Features
调度功能
📄 Read: references/scheduling-features.md
- Timescale configuration (interval and slot count)
- Working days and business hours setup
- Timezone support (IANA timezones)
- Recurrence patterns (RFC 5545 format)
- Resource configuration and grouping
- Complete scheduling configuration example
📄 阅读: references/scheduling-features.md
- 时间刻度配置(间隔和槽位数)
- 工作日和营业时间设置
- 时区支持(IANA时区)
- 重复规则(RFC 5545格式)
- 资源配置和分组
- 完整调度配置示例
Data Binding
数据绑定
📄 Read: references/data-binding.md
- Local data binding with DataSource
- Remote data binding with ODataV4Adaptor
- Custom adaptor creation
- Query parameters and filters
- AJAX data loading
- CRUD action configuration with UrlAdaptor
- Google Calendar integration
📄 阅读: references/data-binding.md
- 使用DataSource实现本地数据绑定
- 使用ODataV4Adaptor实现远程数据绑定
- 自定义适配器创建
- 查询参数和过滤器
- AJAX数据加载
- 使用UrlAdaptor配置CRUD操作
- Google Calendar集成
Customization and Templates
自定义和模板
📄 Read: references/customization.md
- Event templates and cell templates
- Event customization using eventRendered event
- CSS class customization
- Tooltip templates and display options
- Custom editor window configuration
- Overlapping event prevention
📄 阅读: references/customization.md
- 事件模板和单元格模板
- 使用eventRendered事件自定义事件
- CSS类自定义
- 提示框模板和展示选项
- 自定义编辑器窗口配置
- 事件重叠预防
Advanced Features
高级功能
📄 Read: references/advanced-features.md
- Resource grouping and multi-resource scheduling
- Timezone support and conversion
- Virtual scrolling for performance
- State persistence
- Exporting and printing
- Localization and accessibility
- Inline appointment editing
- Read-only mode and appointment blocking
📄 阅读: references/advanced-features.md
- 资源分组和多资源调度
- 时区支持和转换
- 性能优化虚拟滚动
- 状态持久化
- 导出和打印
- 国际化和无障碍适配
- 行内预约编辑
- 只读模式和预约阻塞
Quick Start Example
快速开始示例
cshtml
<!-- _Layout.cshtml -->
<head>
<!-- refer syncfusion theme -->
<!-- refer syncfusion script -->
</head>
<body>
<!-- Scheduler will render here -->
<ejs-scripts></ejs-scripts>
</body>
<!-- Index.cshtml -->
@addTagHelper *, Syncfusion.EJ2
<ejs-schedule id="schedule" width="100%" height="550" selectedDate="new DateTime(2024, 3, 28)" currentView="Week">
<e-schedule-eventsettings dataSource="ViewBag.datasource"></e-schedule-eventsettings>
</ejs-schedule>
// Controller
public class HomeController : Controller
{
public IActionResult Index()
{
ViewBag.datasource = new List<AppointmentData>
{
new AppointmentData {
Id = 1,
Subject = "Meeting",
StartTime = new DateTime(2024, 3, 28, 9, 0, 0),
EndTime = new DateTime(2024, 3, 28, 10, 0, 0)
}
};
return View();
}
}
public class AppointmentData
{
public int Id { get; set; }
public string Subject { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
}cshtml
<!-- _Layout.cshtml -->
<head>
<!-- refer syncfusion theme -->
<!-- refer syncfusion script -->
</head>
<body>
<!-- Scheduler will render here -->
<ejs-scripts></ejs-scripts>
</body>
<!-- Index.cshtml -->
@addTagHelper *, Syncfusion.EJ2
<ejs-schedule id="schedule" width="100%" height="550" selectedDate="new DateTime(2024, 3, 28)" currentView="Week">
<e-schedule-eventsettings dataSource="ViewBag.datasource"></e-schedule-eventsettings>
</ejs-schedule>
// Controller
public class HomeController : Controller
{
public IActionResult Index()
{
ViewBag.datasource = new List<AppointmentData>
{
new AppointmentData {
Id = 1,
Subject = "Meeting",
StartTime = new DateTime(2024, 3, 28, 9, 0, 0),
EndTime = new DateTime(2024, 3, 28, 10, 0, 0)
}
};
return View();
}
}
public class AppointmentData
{
public int Id { get; set; }
public string Subject { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
}Common Patterns
常用模式
Adding Events Programmatically
编程方式添加事件
csharp
// Use addEvent method to create appointments
<script>
var scheduleObj = document.getElementById('schedule').ej2_instances[0];
scheduleObj.addEvent({
Id: 2,
Subject: 'New Meeting',
StartTime: new Date(2024, 2, 28, 10, 0),
EndTime: new Date(2024, 2, 28, 11, 0)
});
</script>csharp
// Use addEvent method to create appointments
<script>
var scheduleObj = document.getElementById('schedule').ej2_instances[0];
scheduleObj.addEvent({
Id: 2,
Subject: 'New Meeting',
StartTime: new Date(2024, 2, 28, 10, 0),
EndTime: new Date(2024, 2, 28, 11, 0)
});
</script>Handling CRUD Operations
处理CRUD操作
csharp
// Server-side in DataManager with CrudUrl
var dataManager = new DataManager() {
Url = "Home/GetData",
Adaptor = "UrlAdaptor",
CrudUrl = "Home/UpdateData",
// Configure server-side CORS with explicit allowed origins rather than relying on a client-side CrossDomain flag.
};csharp
// Server-side in DataManager with CrudUrl
var dataManager = new DataManager() {
Url = "Home/GetData",
Adaptor = "UrlAdaptor",
CrudUrl = "Home/UpdateData",
// Configure server-side CORS with explicit allowed origins rather than relying on a client-side CrossDomain flag.
};Creating Recurring Events
创建重复事件
csharp
// RecurrenceRule follows iCalendar (RFC 5545) format
new AppointmentData {
Id = 1,
Subject = "Daily Standup",
StartTime = new DateTime(2024, 3, 28, 9, 0, 0),
EndTime = new DateTime(2024, 3, 28, 9, 30, 0),
RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10"
}csharp
// RecurrenceRule follows iCalendar (RFC 5545) format
new AppointmentData {
Id = 1,
Subject = "Daily Standup",
StartTime = new DateTime(2024, 3, 28, 9, 0, 0),
EndTime = new DateTime(2024, 3, 28, 9, 30, 0),
RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=10"
}Configuring Multiple Views
配置多视图
cshtml
<ejs-schedule id="schedule" currentView="Week">
<e-schedule-views>
<e-schedule-view option="Day"></e-schedule-view>
<e-schedule-view option="Week"></e-schedule-view>
<e-schedule-view option="Month"></e-schedule-view>
<e-schedule-view option="TimelineDay"></e-schedule-view>
</e-schedule-views>
</ejs-schedule>cshtml
<ejs-schedule id="schedule" currentView="Week">
<e-schedule-views>
<e-schedule-view option="Day"></e-schedule-view>
<e-schedule-view option="Week"></e-schedule-view>
<e-schedule-view option="Month"></e-schedule-view>
<e-schedule-view option="TimelineDay"></e-schedule-view>
</e-schedule-views>
</ejs-schedule>Key Properties and Events
核心属性和事件
Core Scheduler Properties
Scheduler核心属性
- : Active view type (Day, Week, WorkWeek, Month, Year, Agenda, MonthAgenda, TimelineDay, TimelineWeek, TimelineWorkWeek, TimelineMonth, TimelineYear)
currentView - : Current date displayed on Scheduler
selectedDate - : Disables all CRUD operations when true
readonly - : Enables drag-and-drop (default: true)
allowDragAndDrop - : Enables event resizing (default: true)
allowResizing - : Enables dragging multiple events simultaneously
allowMultiDrag - : Enables inline editing of event subject
allowInline - : Prevents overlapping events when false
allowOverlap - and
height: Dimension settingswidth - : Custom CSS class for styling
cssClass
- : 激活的视图类型(Day, Week, WorkWeek, Month, Year, Agenda, MonthAgenda, TimelineDay, TimelineWeek, TimelineWorkWeek, TimelineMonth, TimelineYear)
currentView - : Scheduler当前展示的日期
selectedDate - : 设为true时禁用所有CRUD操作
readonly - : 启用拖放功能(默认:true)
allowDragAndDrop - : 启用事件大小调整功能(默认:true)
allowResizing - : 启用同时拖动多个事件功能
allowMultiDrag - : 启用事件标题行内编辑功能
allowInline - : 设为false时禁止事件重叠
allowOverlap - 和
height: 尺寸设置width - : 用于样式自定义的CSS类
cssClass
Event Settings Properties
事件设置属性
- : Binds appointment data (array or DataManager)
dataSource - : Custom template for event display
template - : Shows tooltip for appointments
enableTooltip - : Customizes tooltip content
tooltipTemplate - : Events occupy full cell height
enableMaxHeight - : Shows more indicator for multiple events
enableIndicator - : AllDayRow or TimeSlot for multi-day events
spannedEventPlacement - : Custom sort function for overlapping events
sortComparer - : Allows editing current and following recurring events
editFollowingEvents
- : 绑定预约数据(数组或DataManager)
dataSource - : 事件展示的自定义模板
template - : 展示预约提示框
enableTooltip - : 自定义提示框内容
tooltipTemplate - : 事件占满单元格高度
enableMaxHeight - : 多事件时展示更多指示器
enableIndicator - : 跨天事件展示位置(AllDayRow或TimeSlot)
spannedEventPlacement - : 重叠事件的自定义排序函数
sortComparer - : 允许编辑当前及后续重复事件
editFollowingEvents
Event Field Mapping
事件字段映射
- : Unique appointment identifier (required)
id - : Appointment title
subject - : Start date/time (required)
startTime - : End date/time (required)
endTime - : All-day event flag
isAllDay - : Event location
location - : Event details
description - : Recurrence pattern (iCalendar format)
recurrenceRule - : Parent recurring event ID for exceptions
recurrenceID - : Excluded dates from recurrence
recurrenceException - : Parent event ID for "following events" edits
followingID - : Start time timezone (IANA timezone names)
startTimezone - : End time timezone
endTimezone - : Individual event read-only flag
isReadonly - : Time slot blocking flag
isBlock
- : 唯一预约标识符(必填)
id - : 预约标题
subject - : 开始日期/时间(必填)
startTime - : 结束日期/时间(必填)
endTime - : 全天事件标记
isAllDay - : 事件地点
location - : 事件详情
description - : 重复规则(iCalendar格式)
recurrenceRule - : 异常事件对应的父重复事件ID
recurrenceID - : 重复规则排除的日期
recurrenceException - : "编辑后续事件"对应的父事件ID
followingID - : 开始时间时区(IANA时区名称)
startTimezone - : 结束时间时区
endTimezone - : 单个事件只读标记
isReadonly - : 时间段阻塞标记
isBlock
Important Events
重要事件
- : Triggered before CRUD actions
actionBegin - : Triggered after CRUD actions complete
actionComplete - : Triggered on server errors
actionFailure - : Triggered before event rendering (customization)
eventRendered - : Triggered when dragging begins
dragStart - : Triggered when dragging ends
dragStop - : Triggered when resizing begins
resizeStart - : Triggered before editor window opens
popupOpen - : Triggered before tooltip displays
tooltipOpen - : Triggered after data binding completes
dataBound
- : CRUD操作触发前执行
actionBegin - : CRUD操作完成后触发
actionComplete - : 服务端报错时触发
actionFailure - : 事件渲染前触发(用于自定义)
eventRendered - : 拖动开始时触发
dragStart - : 拖动结束时触发
dragStop - : 大小调整开始时触发
resizeStart - : 编辑器窗口打开前触发
popupOpen - : 提示框展示前触发
tooltipOpen - : 数据绑定完成后触发
dataBound
Public Methods
公共方法
- : Add single or multiple appointments
addEvent(eventData) - : Update existing appointments
saveEvent(eventData, action) - : Delete appointments
deleteEvent(eventData, action) - : Retrieve all appointments
getEvents() - : Get appointments in current view
getCurrentViewEvents() - : Get event data from UI element
getEventDetails(element) - : Refresh appointments without full reload
refreshEvents() - : Navigate to specific date
navigateTo(date) - : Go to previous time period
navigatePrevious() - : Go to next time period
navigateNext() - : Check slot availability
isSlotAvailable(date, endDate, resourceId) - : Show overlap validation alert
openOverlapAlert()
- : 添加单个或多个预约
addEvent(eventData) - : 更新现有预约
saveEvent(eventData, action) - : 删除预约
deleteEvent(eventData, action) - : 获取所有预约
getEvents() - : 获取当前视图内的预约
getCurrentViewEvents() - : 从UI元素获取事件数据
getEventDetails(element) - : 刷新预约无需全量重载
refreshEvents() - : 跳转到指定日期
navigateTo(date) - : 跳转到上一个时间段
navigatePrevious() - : 跳转到下一个时间段
navigateNext() - : 检查时间段是否可用
isSlotAvailable(date, endDate, resourceId) - : 展示重叠校验提示
openOverlapAlert()
Related Skills
相关技能
- Data Binding Patterns - Connecting data sources
- Custom Event Templates - Styling and presentation
- Resource Scheduling - Multi-user and resource management
- 数据绑定模式 - 连接数据源
- 自定义事件模板 - 样式和展示
- 资源调度 - 多用户和资源管理