fancy tree를 최초 initailize 할때, icon이라는 함수를 사용해서 icon을 변경할 수 있다.
icon 함수는 event와 data를 argument로 받고, data의 data.node.data에서 트리의 데이터에 접근할 수 있다.
node.data에서 특정값을 확인하고 icon을 변경하고 싶으면, 클래스명을 return 하면 되고, return 값이 없다면.. 기본 icon이 적용된다.
클래스명이 리턴되면, fancy트리는 해당 노드의 span 태그에 fancytree-custom-icon 와 내가 리턴한 클래스명을 클래스로 추가한다.
그리고 나는 아래와 같이 해당 클래스를 추가하면 된다.
span.fancytree-custom-icon.fancytree-use-yn-no {
background-image: url(/resources/images/fancytree/icons.gif);
background-position: -16px -112px
}
'JavaScript > JavaScript' 카테고리의 다른 글
JavaScript Object 비교. (0) | 2015.12.29 |
---|