utils

various helper modules

object utils;

Example

var tooltips = gantt.ext.tooltips;
tooltips.tooltipFor({
    selector: ".gantt_scale_cell",
    html: function (event, node) {
        var domHelper = gantt.utils.dom;
        var pos = domHelper .getRelativeEventPosition(event, gantt.$task_scale);
        return gantt.templates.task_date(gantt.dateFromPos(pos.x));
}
});

Details

Currently the module contains only the helper for DOM operations available at gantt.utils.dom

 
var domHelpers = gantt.utils.dom;

Which have following methods:

  • object domHelpers.getNodePosition(HTMLElement node) - returns position of the element on the screen in the format of {x:number, y:number,width:number, height:number} object
  • object domHelpers.getRelativeEventPosition(event e, HTMLElement node) - returns mouse coordinates relatively to the DOM element in the format of {x:number, y:number} object
  • boolean domHelpers.isChildOf(HTMLElement child, HTMLElement parent) - returns true if the node provided as the first argument is DOM child of the node provided as the second argument
  • boolean domHelpers.hasClass(HTMLElement node, string className) - returns true if the class list of the provided node contains a specified css class
  • HTMLElement domHelpers.closest(HTMLElement node, string cssSelector) - returns the first node that matches the provided css celector, starting from the node attribute, up to its DOM parents' branch.
Back to top