본문으로 건너뛰기

xml_date

경고

템플릿은 더 이상 사용되지 않습니다.

Description

XML 파일의 문자열이 이 템플릿에 따라 날짜 객체로 변환됩니다

Parameters

  • date - (required) Date - 포맷이 필요한 날짜

Returns

  • text - (string) - gantt에서 렌더링될 HTML 텍스트

Example

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

Details

노트

템플릿이 더 이상 사용되지 않습니다. 대신 parse_date를 사용하세요:

const cfg = gantt.config;
const strToDate = gantt.date.str_to_date(cfg.date_format, cfg.server_utc);

gantt.templates.parse_date = function(date){
return strToDate (date);
};

이 템플릿은 xml_date 설정에서 자동으로 생성되며, gantt 초기화 이후에 재정의할 수 있습니다.

서버 날짜 형식이 gantt date helper에 의해 지원되지 않는 경우에도 사용자 정의 템플릿 함수를 사용할 수 있습니다.

예를 들어 start_date에 UNIX 타임을 사용하는 경우:

snippet /data :

{
"data":[
{
"id":1,
"start_date":1503608400,
"duration":10,
"text":"Task #1",
"parent":0,
},
{
"id":2,
"start_date":1503694800,
"duration":4,
"text":"Task #2",
"parent":0,
}],

"links":[
]
}

다음과 같이 Gantt 구성을 설정해야 합니다:

gantt.attachEvent("onTemplatesReady", function(){
gantt.templates.xml_date = function(dateString){
return new Date(dateString * 1000);
}
});

gantt.init("gantt_here");
gantt.load("/data");

Change log

  • v6.2에서 더 이상 사용되지 않으며, v7.0에서 제거되었습니다

Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.