a date object is converted into a string in conformity with this template. Used to send data back to the server
date | Date | the date which needs formatting |
gantt.templates.xml_format = function(date){
return gantt.date.date_to_str(gantt.config.xml_date)(date);
};
The template is deprecated. Use format_date instead:
var dateToStr = gantt.date.date_to_str("%Y-%m-%d %H:%i");
gantt.templates.format_date = function(date){
return dateToStr (date);
};
This template is automatically generated from the xml_date config and can be redefined after the initialization of gantt.
A custom template function can be used, if the server side expects a format that is not supported by the gantt date helper.
For example, let's say the server side expects start_date as a UNIX timestamp and the request parameters should look like this:
You should set the Gantt configuration as follows:
gantt.attachEvent("onTemplatesReady", function(){
gantt.templates.xml_format = function(date){
return (date.valueOf() / 1000) + "";
}
});
gantt.init("gantt_here");
gantt.load("/data");
var dp = new gantt.dataProcessor("/data");
dp.init(gantt);
dp.setTransactionMode("REST");
deprecated since v6.2, removed since v7.0
Back to top