Mostafa Barmshory
Mostafa Barmshory

Reputation: 2039

Dhtmlx date_scale is not called ever in angular?

While it is possilble to change x-scale date format by date_scale from template, it is not work in Angular. I add a directive based on this tutorial, and then add the following code:

gantt.templates.date_scale = function(date){
    return gantt.date.date_to_str(gantt.config.date_scale)(date);
};

However, the method is called never.

Upvotes: 0

Views: 112

Answers (1)

hadi.mansouri
hadi.mansouri

Reputation: 828

This is a bug in DHTMLX Gantt (https://forum.dhtmlx.com/viewtopic.php?f=15&t=32888&p=141311&hilit=gantt.templates.date_scale#p141311). Up to now, this bug is not fixed but as you can see in the mentioned link (which is a link from their forum) there is a trick. You can use events as following to get what you want:

gantt.attachEvent("onTemplatesReady", function() {
    gantt.templates.date_scale = function(
        return gantt.date.date_to_str("%Y, %F %j")(date);
    };

    gantt.templates.scale_cell_class = function(date){
        return "newWidth";    
    };
});

Upvotes: 1

Related Questions