Mostafa Barmshory
Mostafa Barmshory

Reputation: 2039

I override api_date of themplates in DHTMLX but it is not used?

In dhtmlx gantt, you can format input date (from string or any type) into javascript date. This date is used to draw chart. Base on the dhtmlx document, you can replace converter (api_date) by custom function:

I override the function as follow:

 gantt.templates.api_date = function(date){
    throw "It is called";
 };

but, it never is called.

Upvotes: 0

Views: 84

Answers (2)

Polina
Polina

Reputation: 412

api_date template and config are no longer used. We will update the information in the documentation. Please use xml_date as hadi.mansouri suggested.

Upvotes: 1

hadi.mansouri
hadi.mansouri

Reputation: 828

I don`t know why this function is not called. I also confuse for this, because official documents of DHMTLX Gantt (as you mentioned, api_date) say it should works.

However I found that if you override xml_date it will work as you want. Although it is named xml_date but it works for json data also.

So could use following snippet:

gantt.templates.xml_date = function(date){
    // Your customized code.
    // return a Date object.
};

Upvotes: 1

Related Questions