Static_background, highlight weekends

Currently after a certain number of tasks have been added, we switch to a the static background. On the non static background we add the highlight with the following code:

[code] gantt.config.scale_unit = “week”;
gantt.config.date_scale = “%d-%M-%Y”;
gantt.config.step = 1;

    gantt.config.subscales = [
        { unit: "day", step: 1, date: "%k", css: template }
    ];


    var template = function (date) {
        var classNames = "";
        if (!gantt.isWorkTime(date)) {
            classNames = "nonWorkDay ";
        }
        if (today.getFullYear() == date.getFullYear() && today.getMonth() == date.getMonth() && today.getDate() == date.getDate()) {
            classNames += "today";
        }
        return classNames;
    };

    gantt.templates.task_cell_class = function (item, date) {
        var classNames = "";
        if (!gantt.isWorkTime(date)) {
            classNames = "nonWorkDay ";
        }
        if (today.getFullYear() == date.getFullYear() && today.getMonth() == date.getMonth() && today.getDate() == date.getDate()) {
            classNames += "today";
        }
        return classNames;
    };[/code]

Giving us the result:

Is there anyway to get this to work with the static background?

Hello,
unfortunately it’s not possible with the current version of a component.
static_background creates a timeline grid from a single cell, so all columns has the same color. Highlighting of holidays will require rewriting the static bg helper (although the helper itself is not very complicated), check the source codes for definition of gantt._render_bg_canvas method

I was able to achieve this by adding a marker for the days I wanted highlighted. Doesn’t seem to have much of a performance impact. If anyone else is looking for a solution!