본문으로 건너뛰기

xml_format

Description

날짜 객체를 이 템플릿에 따라 문자열로 변환합니다. 이 문자열은 서버에 데이터를 전송할 때 사용됩니다.

Parameters

  • date - (required) Date - 포맷팅이 필요한 날짜 객체입니다.

Returns

  • text - (string) - Gantt 차트에 표시될 HTML 텍스트입니다.

Example

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

Details

노트

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

var dateToStr = gantt.date.date_to_str("%Y-%m-%d %H:%i");
gantt.templates.format_date = function(date){
return dateToStr(date);
};

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

서버에서 Gantt 날짜 헬퍼에서 지원하지 않는 날짜 형식을 요구하는 경우, 사용자 정의 템플릿 함수를 생성할 수 있습니다.

예를 들어, 서버가 start_date를 UNIX 타임스탬프로 기대하고 요청 파라미터가 다음과 같아야 한다면:

  • start_date:1503608400
  • duration:4
  • text:Task #2.2
  • parent:3
  • end_date:1503694800

Gantt 구성은 다음과 같이 설정할 수 있습니다:

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");

Change log

  • v6.2부터 deprecated 되었으며, v7.0에서 제거되었습니다.