跳转到主要内容

只读模式

在本节中,我们将只读模式放在以下四种情境中进行考虑:

  1. 为整个调度器设置只读模式;
  2. 为整个 Lightbox(编辑弹出窗)设置只读模式;
  3. 为某个 Lightbox 的区域设置只读模式;
  4. 为特定事件设置只读模式.

为整个调度器设置只读模式

要将整个调度器设为只读,请将 readonly 选项设置为 true

scheduler.config.readonly = true;
...
scheduler.init('scheduler_here', new Date(2027, 5, 11), "month");

注意,当整个调度器不可编辑时,用户将无法打开 Lightbox(编辑弹出窗)。

为整个 Lightbox(编辑弹出窗)设置只读模式

为了让用户仍然可以打开 Lightbox(编辑弹出窗),但禁止其中任何编辑,请将 readonly_form 选项设置为 true

scheduler.config.readonly_form = true;
...
scheduler.init('scheduler_here', new Date(2027, 5, 11), "month");
注释

readonly 选项在 readonly 扩展中提供,要使用它,请在页面上启用该扩展。

相关示例

为 Lightbox 的区域设置只读模式

要将某个 Lightbox 的区域设为只读,请使用相关区域对象的 DOM 元素的 disabled 属性:

scheduler.config.lightbox.sections = [
{ name: "description", height: 200, map_to: "text", type: "textarea", focus: true },
{ name: "time", height: 72, type: "time", map_to: "auto" }
];

scheduler.attachEvent("onLightbox", () => {
const descriptionSection = scheduler.formSection("description");
descriptionSection.control.disabled = true;
});
注释

请注意,你通过它的类型来引用该区域;具有该类型的所有区域将同时变为只读。

为特定事件设置只读模式

要让特定事件变为只读,请在它们上添加 readonly 属性并将其设为 true

scheduler.getEvent(id).readonly = true;
注释

该功能由 readonly 扩展提供,使用该功能请在页面上启用该扩展。

相关示例

Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.