Available only in PRO Edition

Overlay 扩展

该功能仅在 PRO 版本中可用。

overlay 扩展提供了一组 API 方法,用于简化叠加层的操作。欲了解更多详细信息,请参阅文章 时间线区域中的自定义元素

方法

以下方法可通过 gantt.ext.overlay 对象访问:

addOverlay

  • addOverlay (render, id): string | number - 向 Gantt 图表中插入一个新的叠加层,并返回其 id
    • render - (Function): HTMLElement - 负责渲染的函数。它接收一个带有自定义内容的容器作为参数
      • container - (HTMLElement) - 叠加层的容器
    • id? - (number | string) - 可选,指定叠加层的 ID
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);
Back to top