[jsTree] jsTree 사용해보기

2021. 3. 3. 23:48· dev/JavaScript
목차
  1. 공식사이트 버전 테스트 
  2. 인터넷 참고테스트 

프로젝트에서 jsTree로 개발되어있는 프로젝트가 있는데 버전마다 사용법이 다른거 같아서 .. 개념잡기 위해 테스트 해본걸 남겨놓는다. 

eclipse로 cdn 연결해서 테스트 했으니 인터넷 안되는 환경에서는 다운로드 받아서 하시길..

 

jsTree 공식사이트

www.jstree.com/

 

jstree

jsTree is jquery plugin, that provides interactive trees. It is absolutely free, open source and distributed under the MIT license. jsTree is easily extendable, themable and configurable, it supports HTML & JSON data sources and AJAX loading.

www.jstree.com

 

공식사이트 버전 테스트 

<!DOCTYPE html>
<html lang="ko">
<head>
<!-- jsTree theme -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
</head>
<body>
<div id="jstree">
	<ul>
      <li>Root node 1
        <ul>
          <li id="child_node_1">Child node 1</li>
          <li>Child node 2</li>
        </ul>
      </li>
      <li>Root node 2</li>
    </ul>
</div>
<button>demo button</button>
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<!-- jsTree -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script>
$(function () { 
	$('#jstree').jstree(); 
		
	$('#jstree').on("changed.jstree", function (e, data) {
      console.log(data.selected);
    });
	
	$('button').on('click', function () {
      $('#jstree').jstree(true).select_node('child_node_1');
      $('#jstree').jstree('select_node', 'child_node_1');
      $.jstree.reference('#jstree').select_node('child_node_1');
    });
});
</script>
</body>
</html>

 

jsTree 테스트

 

인터넷 참고테스트 

<!DOCTYPE html>
<html lang="ko">
<head>
<!-- jsTree theme -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
</head>
<body>
<div id="tree"></div>
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<!-- jsTree -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script>
$(function () { 
    
    $('#tree').jstree({ 
		'core' : {
			'data' : [
				{ "id" : "ajson1", "parent" : "#", "text" : "Simple root node" },
				{ "id" : "ajson2", "parent" : "#", "text" : "Root node 2" },
				{ "id" : "ajson3", "parent" : "ajson2", "text" : "Child 1" },
				{ "id" : "ajson4", "parent" : "ajson2", "text" : "Child 2" }
			]
		}
   	});
});
</script>
</body>
</html>

 

jsTree 인터넷 참고 test

 

'dev > JavaScript' 카테고리의 다른 글

[jsTree] 함수 정리  (0) 2021.03.11
[jsTree] jsTree plugin 알아보기  (0) 2021.03.04
jQuery Code Assist (jQuery 코드 자동완성)  (0) 2017.05.06
여러가지 객체사용법 2  (0) 2017.04.27
여러가지 객체사용법 1  (0) 2017.04.27
  1. 공식사이트 버전 테스트 
  2. 인터넷 참고테스트 
'dev/JavaScript' 카테고리의 다른 글
  • [jsTree] 함수 정리
  • [jsTree] jsTree plugin 알아보기
  • jQuery Code Assist (jQuery 코드 자동완성)
  • 여러가지 객체사용법 2
아디봉
아디봉
내인생의 카드는 몇장일까?
아디봉
내이른
아디봉
전체
오늘
어제
  • 분류 전체보기 (81)
    • 경제적자유 (11)
      • 경제노트 (4)
      • 부동산노트 (3)
      • 책리뷰 (1)
      • 유튜브 (2)
    • dev (50)
      • 사이드프로젝트 (0)
      • JavaScript (7)
      • 스프링 (5)
      • 자바 (11)
      • docker (7)
      • tdd (0)
      • DB (2)
      • mongoDB (1)
      • python (1)
      • react (9)
      • 인증.권한 (1)
      • 기타 (5)
      • HTTP (0)
      • JSP (1)
    • life (9)
      • 백패킹 (3)
      • 자기개발 (6)

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

공지사항

인기 글

태그

  • 스프링데이터jpa
  • 백패킹
  • 롬복
  • 쿠키
  • Object
  • logback
  • Cookie
  • javascript jsTree
  • web
  • 파란코끼리들의기적
  • javascript
  • 자바스크립트
  • React
  • Oracle
  • react 이벤트
  • Lombok
  • jstree
  • log4j
  • 객체
  • Java
  • Maven
  • docker
  • Eclipse
  • 옵셔널
  • Java8
  • optional
  • function
  • 파코기
  • 정다르크
  • 자바

최근 댓글

최근 글

hELLO · Designed By 정상우.v4.2.2
아디봉
[jsTree] jsTree 사용해보기
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.