JavaScript
(function() {
"use strict";
/* -- Basic Tree -- */
$('#types-tree').jstree({
'core' : {
'themes' : {
'responsive': false
},
'data' : [
{
"text" : "Project",
"state" : {"opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{
"text" : "Assets",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{ "text" : "CSS", "state" : { "opened" : true }, "icon" : "mdi mdi-file-outline" },
{ "text" : "JS", "icon" : "mdi mdi-file-outline" },
{ "text" : "Fonts", "icon" : "mdi mdi-file-outline" },
{ "text" : "Images", "icon" : "mdi mdi-file-outline" },
{
"text" : "Plugins",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{ "text" : "jQuery", "icon" : "mdi mdi-file-outline" },
{ "text" : "Bootstrap", "state" : { "selected" : true, "opened" : true }, "icon" : "mdi mdi-file-outline" }
]
}
]
},
{
"text" : "Icons",
"icon" : "mdi mdi-opacity"
},
{
"text" : "Events",
"icon" : "mdi mdi-calendar"
},
{
"text" : "UI Kits",
"state" : { "opened" : true },
"icon" : "mdi mdi-package-variant-closed",
"children" : [
{ "text" : "Buttons", "icon" : "mdi mdi-file-outline" },
{ "text" : "Badges", "icon" : "mdi mdi-file-outline" }
]
},
{
"text" : "Forms",
"icon" : "mdi mdi-file-document"
},
{
"text" : "Charts",
"icon" : "mdi mdi-chart-pie"
},
{
"text" : "Pages",
"state" : { "opened" : true },
"icon" : "mdi mdi-book-open-variant",
"children" : [
{ "text" : "Coming Soon", "icon" : "mdi mdi-file-outline" },
{ "text" : "Maintenance", "icon" : "mdi mdi-file-outline" }
]
},
{
"text" : "Tables",
"icon" : "mdi mdi-table"
},
]
},
{
"text" : "Documents",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline"
}
]
},
'plugins' : ['types']
});
/* -- Checkbox Tree -- */
$('#checkbox-tree').jstree({
'core' : {
'themes' : {
'responsive': false
},
'data' : [
{
"text" : "Project",
"state" : {"opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{
"text" : "Assets",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{ "text" : "CSS", "state" : { "opened" : true }, "icon" : "mdi mdi-file-outline" },
{ "text" : "JS", "icon" : "mdi mdi-file-outline" },
{ "text" : "Fonts", "icon" : "mdi mdi-file-outline" },
{ "text" : "Images", "icon" : "mdi mdi-file-outline" },
{
"text" : "Plugins",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{ "text" : "jQuery", "icon" : "mdi mdi-file-outline" },
{ "text" : "Bootstrap", "state" : { "selected" : true, "opened" : true }, "icon" : "mdi mdi-file-outline" }
]
}
]
},
{
"text" : "Icons",
"icon" : "mdi mdi-opacity"
},
{
"text" : "Events",
"icon" : "mdi mdi-calendar"
},
{
"text" : "UI Kits",
"state" : { "opened" : true },
"icon" : "mdi mdi-package-variant-closed",
"children" : [
{ "text" : "Buttons", "icon" : "mdi mdi-file-outline" },
{ "text" : "Badges", "icon" : "mdi mdi-file-outline" }
]
},
{
"text" : "Forms",
"icon" : "mdi mdi-file-document"
},
{
"text" : "Charts",
"icon" : "mdi mdi-chart-pie"
},
{
"text" : "Pages",
"state" : { "opened" : true },
"icon" : "mdi mdi-book-open-variant",
"children" : [
{ "text" : "Coming Soon", "icon" : "mdi mdi-file-outline" },
{ "text" : "Maintenance", "icon" : "mdi mdi-file-outline" }
]
},
{
"text" : "Tables",
"icon" : "mdi mdi-table"
},
]
},
{
"text" : "Documents",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline"
}
]
},
'plugins' : ['types', 'checkbox']
});
/* -- Drag & Drop Tree -- */
$('#drag-drop-tree').jstree({
'core' : {
'themes' : {
'responsive': false
},
'check_callback' : true,
'data' : [
{
"text" : "Project",
"state" : {"opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{
"text" : "Assets",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{ "text" : "CSS", "state" : { "opened" : true }, "icon" : "mdi mdi-file-outline" },
{ "text" : "JS", "icon" : "mdi mdi-file-outline" },
{ "text" : "Fonts", "icon" : "mdi mdi-file-outline" },
{ "text" : "Images", "icon" : "mdi mdi-file-outline" },
{
"text" : "Plugins",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline",
"children" : [
{ "text" : "jQuery", "icon" : "mdi mdi-file-outline" },
{ "text" : "Bootstrap", "state" : { "selected" : true, "opened" : true }, "icon" : "mdi mdi-file-outline" }
]
}
]
},
{
"text" : "Icons",
"icon" : "mdi mdi-opacity"
},
{
"text" : "Events",
"icon" : "mdi mdi-calendar"
},
{
"text" : "UI Kits",
"state" : { "opened" : true },
"icon" : "mdi mdi-package-variant-closed",
"children" : [
{ "text" : "Buttons", "icon" : "mdi mdi-file-outline" },
{ "text" : "Badges", "icon" : "mdi mdi-file-outline" }
]
},
{
"text" : "Forms",
"icon" : "mdi mdi-file-document"
},
{
"text" : "Charts",
"icon" : "mdi mdi-chart-pie"
},
{
"text" : "Pages",
"state" : { "opened" : true },
"icon" : "mdi mdi-book-open-variant",
"children" : [
{ "text" : "Coming Soon", "icon" : "mdi mdi-file-outline" },
{ "text" : "Maintenance", "icon" : "mdi mdi-file-outline" }
]
},
{
"text" : "Tables",
"icon" : "mdi mdi-table"
},
]
},
{
"text" : "Documents",
"state" : { "opened" : true },
"icon" : "mdi mdi-folder-outline"
}
]
},
'plugins' : ['dnd']
});
/* -- Ajax Tree -- */
$('#ajax-tree').jstree({
'core' : {
'animation' : 0,
'check_callback' : true,
'force_text' : true,
'themes' : {
'responsive': false
},
'data' : {
'url' : function (node) {
return node.id === '#' ? 'http://example.itshubao.com/test/ajax_roots.json' : 'http://example.itshubao.com/test/ajax_children.json';
},
'data' : function (node) {
return { 'id' : node.id };
}
}
},
"types" : {
'default' : {
'icon' : 'mdi mdi-folder-outline'
},
'file' : {
'icon' : 'mdi mdi-file-outline'
}
},
"plugins" : [ "contextmenu", "dnd", "search", "state", "types", "wholerow" ]
});
})();