<ul id="explorerUL">
<%
List<FileWrapper> list = (List) request.getAttribute("children");
for(FileWrapper tmp : list) {
%>
<li id="<%=tmp.getRelativePath() %>" class="<%=tmp.getClzName()%>"><%=tmp.getName() %></li>
<%
}
%>
</ul>
$("#tree").fancytree({
source: [
{title: "Node 1", key: "1"}, // 객체하나가 li
{title: "Folder 2", key: "2", folder: true, children: [
{title: "Node 2.1", key: "3"}, // key가 id
{title: "Node 2.2", key: "4"}
]}
],
...
$("#tree").fancytree({
source: {
url: "/getTreeData",
cache: false
},
...
<script type="text/javascript">
$("#explorerUL").on("click", ".folder", function() {
let serverSidePath = $(this).prop("id");
location.href="?base=" + serverSidePath; // 동기 요청
});
</script>
https://github.com/mar10/fancytree/wiki/TutorialExtensions
https://github.com/mar10/fancytree/wiki/ExtDnd
// Events that make tree nodes draggable 출발노드
dragStart: null, // Callback(sourceNode, data), return true to enable dnd
dragStop: null, // Callback(sourceNode, data)
initHelper: null, // Callback(sourceNode, data)
updateHelper: null, // Callback(sourceNode, data)
// Events that make tree nodes accept draggables 도착노드
dragEnter: null, // Callback(targetNode, data)
dragExpand: null, // Callback(targetNode, data), return false to prevent autoExpand
dragOver: null, // Callback(targetNode, data)
dragDrop: null, // Callback(targetNode, data)
dragLeave: null // Callback(targetNode, data)
자기 안에서 이동 복사 막고
폴더 드래깅 막고
relativePath 없애고 key의 path따오기
https://wwwendt.de/tech/fancytree/doc/jsdoc/FancytreeNode.html#getKeyPath