이전 버전에서의 마이그레이션
8.0 -> 9.0
v9.0 업데이트에서는 여러 가지 호환성 깨짐(breaking changes)이 도입되었습니다.
스킨이 CSS 변수로 전환됨
CSS 스킨(테마)이 완전히 재작업되어 이제 CSS 변수를 사용합니다. 컴포넌트의 HTML 구조와 CSS 클래스 이름은 대부분 변경되지 않았으나, 이전 버전의 Gantt용으로 작성된 CSS 스타일은 v9.0에서 의도한 대로 동작하지 않을 수 있습니다.
예를 들어, 다음과 같은 스타일은 작업의 우선순위에 따라 색상을 지정하는 데 사용되었습니다:
<style>
/* 테두리/진행률 색상 오버라이드를 위한 공통 스타일 */
.gantt_task_line{
border-color: rgba(0, 0, 0, 0.25);
}
.gantt_task_line .gantt_task_progress {
background-color: rgba(0, 0, 0, 0.25);
}
/* high */
.gantt_task_line.high {
background-color: #03A9F4;
}
.gantt_task_line.high .gantt_task_content {
color: #fff;
}
/* medium */
.gantt_task_line.medium {
background-color: #f57730;
}
.gantt_task_line.medium .gantt_task_content {
color: #fff;
}
/* low */
.gantt_task_line.low {
background-color: #e157de;
}
.gantt_task_line.low .gantt_task_content {
color: #fff;
}
</style>
v9.0부터는 아래와 같은 스타일로 동일한 효과를 얻을 수 있습니다:
<style>
/* high */
.gantt_task_line.high {
--dhx-gantt-task-background: #d96c49;
--dhx-gantt-task-color: #fff;
}
/* medium */
.gantt_task_line.medium {
--dhx-gantt-task-background: #f57730;
--dhx-gantt-task-color: #fff;
}
/* low */
.gantt_task_line.low {
--dhx-gantt-task-background: #fff;
--dhx-gantt-task-color: #fff;
}
</style>
사용 가능한 변수는 스킨 커스터마이제이션 페이지에서 확인할 수 있습니다.
노트
마이그레이션 시 원하는 디자인을 얻기 위해 기존 CSS를 업데이트해야 할 수 있습니다.
단일 CSS 파일
모든 테마가 이제 하나의 dhtmlxgantt.css 파일에 포함되어 있습니다.
특정 스킨을 활성화하려면 gantt.skin 속성을 사용하세요:
gantt.skin = "material";
또는 setSkin 메서드를 사용할 수 있습니다:
gantt.setSkin("material");
노트
gantt.setSkin()을 사용하면 Gantt가 다시 그려집니다.
terrace 외의 스킨을 사용할 경우 다음과 같은 마이그레이션 절차가 필 요합니다:
- 스킨의 CSS 파일을
dhtmlxgantt.css파일로 교체하세요:
<!-- OLD -->
<link rel="stylesheet" href="./codebase/dhtmlxgantt_material.css" type="text/css">
<!-- NEW -->
<link rel="stylesheet" href="./codebase/dhtmlxgantt.css" type="text/css">
- 자바스크립트에서 필요한 스킨을 활성화하세요:
gantt.setSkin("material");
gantt.init("gantt_here");