Skip to main content

level

타입

number

기본값

0

설명

대시보드의 사용자 권한을 설정합니다.

  • 0: 개발자모드 (editor 창 o, 사이드바 o)
  • 1: 편집모드 (editor 창 x, 사이드바 o)
  • 2: 배치모드 (editor 창 x, 사이드바 x, 위젯 이동 및 크기 변경만 가능)
  • 3: 뷰모드 (editor 창 x, 사이드바 x, 위젯 편집 불가능)

사용 예제

document.addEventListener('DOMContentLoaded', function () {
let opt = window.localStorage.getItem("dashboard_data"); // 기존 정보가 있는지 확인

if (opt == null) {
DashBuilder.create({
id: "dash1",
el: document.getElementById("dashboard_data"),
info: {
options: {
level: 0 // 개발자 모드로 설정
},
...
}
});
} else {
opt = JSON.parse(opt);
opt.options.level = 0; // 저장된 설정에서 level 값을 개발자 모드로 변경
DashBuilder.create({ id: "dash1", el: document.getElementById("dashboard_data"), info: opt });
}
});

참고 사항

tip
  • 대시보드를 초기화하거나 업데이트할 때 level 속성을 변경하여 사용자 권한을 동적으로 조정할 수 있습니다.
  • 저장된 설정을 로드할 때 level 값을 명시적으로 설정하면 기존 설정을 덮어쓸 수 있습니다.