봉 블로그

jsTree 주요 함수 본문

ajax_js

jsTree 주요 함수

idkbj 2010. 9. 24. 19:23

jsTree 는 jQuery 로 만든 tree 컴포넌트 중에 가장 괜찮은 플러그인 인것 같다. 드래그앤드롭등의 tree에서 요구되는 거의 모든 기능들을 지원한다.

Features at a glance

  • Various data sources - HTML, JSON, XML
  • Supports AJAX loading
  • Drag & drop support
  • Highly configurable
  • Theme support + included themes
  • Uses jQuery's event system
  • Optional keyboard navigation
  • Maintain the same tree in many languages
  • Inline editing
  • Open/close optional animation
  • Define node types and fine tune them
  • Configurable multitree drag & drop
  • Optional checkbox tree support
  • Search function
  • Supports plugins
  • Optional state saving using cookies
  • RTL support
  • Optional sorting / unique management

주요 함수

//선택된 node id 가져오기
var node_id = $("#treeId",).jstree("get_selected").attr("id");


// 현재 선택된 node 의 경로 가져오기
// 반환값은 node 명 array object.
var pathArray = $("#treeId").jstree("get_path","#selected_node_id");

// 선택한 노드의 parent node 가져오기
var parent_node = $("#treeId").jstree("_get_parent","#selected_node_id");
// jsTree 1.0-rc2 버전에서 위 호출방식이 안되고, 아래와 같은 방식으로 호출해야함. 
var parent_node = $.jstree._reference("#treeId")._get_parent("#selected_node_id");