addLinkLayer

displays an additional layer with custom elements for a link in the timeline area

string addLinkLayer(function|object func);

Parameters

funcfunction|objecta render function or a config object

Returns

stringa DOM element that will be displayed in the layer

Available only in PRO Edition

Example

gantt.addLinkLayer(function (link) {
  var node = gantt.getLinkNode(link.id)
  if (node) {
    var el = document.createElement('div');
    el.className = 'link_layer';
    el.style.left = node.childNodes[2].offsetLeft + 'px'
    el.style.width = 25 + 'px'
    el.style.top = node.childNodes[2].offsetTop + 'px'
    el.style.height = 25 + 'px'
    return el;
  }
  return false;
});

Details

This functionality is available in the PRO edition only.

  • The argument function takes a link's object as a parameter and must return a DOM element that will be displayed in the layer.
  • The argument can also be an object. In this case, it can have the following properties:
    • render - (function) a function that answers for rendering the layer's elements (mandatory)
    • container - (HTMLElement) a layer's container (optional)
    • topmost - (boolean) if true, the element will be displayed over the link (optional)
    • filter - (function) a function that takes a link object as a parameter. If returns 'false', the 'render' function won't be called for a link (optional)
  • Beware, custom layers will be reset after the next call of gantt.init

Related sample:  addLinkLayer

See also
Back to top