覆盖层扩展
信息
此功能仅在 PRO 版中可用。
覆盖层扩展包含一组 API 方法,用于简化对覆盖层的操作。有关 Overlay 扩展的详细信息,请阅读文章 时间线区域中的自定义元素。
方法
以下方法通过 gantt.ext.overlay 对象提供:
addOverlay
- addOverlay (render, id): string | number - 在甘特图中添加一个新的覆盖层并返回其 id
- render - (Function): HTMLElement - 渲染函数。将带有自定义内容的容器作为参数传入
- container - (HTMLElement) - 覆盖层容器
- id? - (number | string) - 可选,覆盖层的 ID
- render - (Function): HTMLElement - 渲染函数。将带有自定义内容的容器作为参数传入
var overlay = gantt.ext.overlay.addOverlay(function(container){});
deleteOverlay
- deleteOverlay (id): boolean - 根据其 id 移除一个覆盖层
- id - (number | string) - 覆盖层的 ID
gantt.ext.overlay.deleteOverlay(id);
getOverlaysIds
- getOverlaysIds (): Array<string> - 返回一个包含已添加到图表中的覆盖层 ID 的数组
var ids = gantt.ext.overlay.getOverlaysIds();
refreshOverlay
- refreshOverlay (id): void - 重新绘制指定的覆盖层。
- id - (number | string) - 覆盖层的 ID
gantt.ext.overlay.refreshOverlay(id);
showOverlay
- showOverlay (id): void - 按其 ID 显示覆盖层。
- id - (number | string) - 覆盖层的 ID
gantt.ext.overlay.showOverlay(id);
hideOverlay
- hideOverlay (id): void - 按其 ID 隐藏覆盖层
- id - (number | string) - 覆盖层的 ID
gantt.ext.overlay.hideOverlay(id);
isOverlayVisible
- isOverlayVisible (id): boolean - 检查指定覆盖层的可见性。如果覆盖层可见,则返回 true。
- id - (number | string) - 覆盖层的 ID
var isVisible = gantt.ext.overlay.isOverlayVisible(id);
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.