개발 Life

jsTree Theme(ν…Œλ§ˆ), μ•„μ΄μ½˜ μ„€μ •

SOBOB 2016. 2. 16. 12:57
λ°˜μ‘ν˜•

데λͺ¨

http://www.orangehilldev.com/jstree-bootstrap-theme/demo/



λ‹€μš΄λ‘œλ“œ


https://github.com/orangehill/jstree-bootstrap-theme




1. css μ†ŒμŠ€ 링크

<link rel="stylesheet" href="/jstree/themes/proton/style.min.css">

μœ„μ˜ theme을 λ‹€μš΄λ‘œλ“œ ν•˜κ³ , μœ„ 경둜의 μŠ€νƒ€μΌμ‹œνŠΈλ₯Ό μ°Έμ‘°ν•˜λ©΄ 끝!

 - λΆ€νŠΈμŠ€νŠΈλž©μœΌλ‘œ κ΅¬μ„±λœ νŽ˜μ΄μ§€λΌ, λΆ€νŠΈμŠ€νŠΈλž© μ„€μ • μƒλž΅.



2. jstree μ„€μ • (JS)


$('#tree').jstree({

'plugins': ["wholerow"],

'core' : {

'data' : data

},

'themes' : {

'name' : 'proton',

'responsive' : true

}

}

});



3. 데이터

//server side μž‘μ—… μ‹œ, children을 ν¬ν•¨ν•œ 데이터에 "glyphicon glyphicon-leaf" μ§€μ •ν•΄μ€Œ

var data =  [

    {

      "id": "1",

      "parent": "#",

      "text": "TEST",

      "icon": "/jstree/themes/proton/tree_icon.png" //root μ•„μ΄μ½˜ 지정

    },

    {

      "id": "2",

      "parent": "1",

      "text": "New1",

      "icon": "glyphicon glyphicon-leaf"

    },

    {

      "id": "3",

      "parent": "1",

      "text": "New2",

      "icon": "glyphicon glyphicon-leaf"

    }

  ]



4. κ²°κ³Ό






μ΅œμƒμœ„ λ…Έλ“œ (ROOT)의 μ•„μ΄μ½˜μ€ λ‹€μš΄λ°›μ€ theme 폴더 μ•ˆμ— μ—†λŠ” μ•„μ΄μ½˜μ΄λΌ jstree 데λͺ¨μ‚¬μ΄νŠΈμ—μ„œ λ– μ˜΄


기타 μ‚¬μš©μ›ν•˜λŠ” icon은 png ν˜•μ‹μ˜ 이미지 파일둜 지정 ν›„ μ‚¬μš© κ°€λŠ₯.


 icon url : https://www.jstree.com/static/3.2.1/assets/images/tree_icon.png β†’ νŠΈλ¦¬μ•„μ΄μ½˜




β–Ό μ μš© Tree λͺ¨μŠ΅ β–Ό


μžμ‹μ΄ μžˆλŠ” λΆ€λͺ¨λ…Έλ“œλŠ” leaf, μ΅œν•˜μœ„ λ…Έλ“œλŠ” κΈ°λ³Έ 폴더 μ•„μ΄μ½˜ 적용.





β–Ό JSFiddle - μ˜ˆμ œ β–Ό 


http://jsfiddle.net/Jay89/8381ds5p/





view, modeling μͺ½μ€ μˆ˜μ›”ν–ˆμœΌλ‚˜..
μ„œλ²„μͺ½ 닀루기가 κΉŒλ‹€λ‘œμš΄ λͺ¨λ“ˆ
κ·Έλž˜λ„ μ›ν™œνžˆ μž‘μ—… λλ‚΄μ„œ λ‹€ν–‰.

moon_and_james-41 


λ°˜μ‘ν˜•