Created
May 6, 2025 00:37
-
-
Save documentprocessing/5c24bc4c8ec221c6d9171af4c8fac6f7 to your computer and use it in GitHub Desktop.
Checkboxes and Drag and Drop using Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| $('#advancedTree').jstree({ | |
| 'plugins': ['checkbox', 'dnd'], | |
| 'core': { | |
| 'data': [ | |
| { | |
| "text": "Documents", | |
| "state": { "opened": true }, | |
| "children": [ | |
| { "text": "Project.docx", "type": "file" }, | |
| { "text": "Report.pdf", "type": "file" }, | |
| { | |
| "text": "Images", | |
| "children": [ | |
| { "text": "photo1.jpg", "type": "file" }, | |
| { "text": "photo2.png", "type": "file" } | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "text": "Music", | |
| "children": [ | |
| { "text": "song1.mp3", "type": "file" }, | |
| { "text": "song2.mp3", "type": "file" } | |
| ] | |
| } | |
| ] | |
| }, | |
| 'checkbox': { | |
| 'keep_selected_style': false | |
| }, | |
| 'types': { | |
| 'file': { | |
| 'icon': 'fa fa-file' | |
| } | |
| } | |
| }); | |
| // Handle checkbox selections | |
| $('#advancedTree').on('changed.jstree', function(e, data) { | |
| console.log('Selected nodes:', data.selected); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment