making it work but it's sort of a mess
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTJSTreeAjax = function() {
|
||||
// Private functions
|
||||
var exampleAjax = function() {
|
||||
$("#kt_docs_jstree_ajax").jstree({
|
||||
"core": {
|
||||
"themes": {
|
||||
"responsive": false
|
||||
},
|
||||
// so that create works
|
||||
"check_callback": true,
|
||||
'data': {
|
||||
'url': function(node) {
|
||||
return 'https://preview.keenthemes.com/api/jstree/ajax_data.php'; // Demo API endpoint -- Replace this URL with your set endpoint
|
||||
},
|
||||
'data': function(node) {
|
||||
return {
|
||||
'parent': node.id
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": {
|
||||
"default": {
|
||||
"icon": "fa fa-folder text-primary"
|
||||
},
|
||||
"file": {
|
||||
"icon": "fa fa-file text-primary"
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"key": "demo3"
|
||||
},
|
||||
"plugins": ["dnd", "state", "types"]
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public Functions
|
||||
init: function() {
|
||||
exampleAjax();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTJSTreeAjax.init();
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTJSTreeBasic = function() {
|
||||
// Private functions
|
||||
var exampleBasic = function() {
|
||||
$('#kt_docs_jstree_basic').jstree({
|
||||
"core" : {
|
||||
"themes" : {
|
||||
"responsive": false
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"default" : {
|
||||
"icon" : "fa fa-folder"
|
||||
},
|
||||
"file" : {
|
||||
"icon" : "fa fa-file"
|
||||
}
|
||||
},
|
||||
"plugins": ["types"]
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public Functions
|
||||
init: function() {
|
||||
exampleBasic();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTJSTreeBasic.init();
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTJSTreeCheckable = function() {
|
||||
// Private functions
|
||||
var exampleCheckable = function() {
|
||||
$('#kt_docs_jstree_checkable').jstree({
|
||||
'plugins': ["wholerow", "checkbox", "types"],
|
||||
'core': {
|
||||
"themes" : {
|
||||
"responsive": false
|
||||
},
|
||||
'data': [{
|
||||
"text": "Same but with checkboxes",
|
||||
"children": [{
|
||||
"text": "initially selected",
|
||||
"state": {
|
||||
"selected": true
|
||||
}
|
||||
}, {
|
||||
"text": "custom icon",
|
||||
"icon": "fa fa-warning text-danger"
|
||||
}, {
|
||||
"text": "initially open",
|
||||
"icon" : "fa fa-folder text-default",
|
||||
"state": {
|
||||
"opened": true
|
||||
},
|
||||
"children": ["Another node"]
|
||||
}, {
|
||||
"text": "custom icon",
|
||||
"icon": "fa fa-warning text-waring"
|
||||
}, {
|
||||
"text": "disabled node",
|
||||
"icon": "fa fa-check text-success",
|
||||
"state": {
|
||||
"disabled": true
|
||||
}
|
||||
}]
|
||||
},
|
||||
"And wholerow selection"
|
||||
]
|
||||
},
|
||||
"types" : {
|
||||
"default" : {
|
||||
"icon" : "fa fa-folder text-warning"
|
||||
},
|
||||
"file" : {
|
||||
"icon" : "fa fa-file text-warning"
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public Functions
|
||||
init: function() {
|
||||
exampleCheckable();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTJSTreeCheckable.init();
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTJSTreeContextual = function() {
|
||||
// Private functions
|
||||
var exampleContextual = function() {
|
||||
$("#kt_docs_jstree_contextual").jstree({
|
||||
"core" : {
|
||||
"themes" : {
|
||||
"responsive": false
|
||||
},
|
||||
// so that create works
|
||||
"check_callback" : true,
|
||||
'data': [{
|
||||
"text": "Parent Node",
|
||||
"children": [{
|
||||
"text": "Initially selected",
|
||||
"state": {
|
||||
"selected": true
|
||||
}
|
||||
}, {
|
||||
"text": "Custom Icon",
|
||||
"icon": "flaticon2-hourglass-1 text-danger"
|
||||
}, {
|
||||
"text": "Initially open",
|
||||
"icon" : "fa fa-folder text-success",
|
||||
"state": {
|
||||
"opened": true
|
||||
},
|
||||
"children": [
|
||||
{"text": "Another node", "icon" : "fa fa-file text-waring"}
|
||||
]
|
||||
}, {
|
||||
"text": "Another Custom Icon",
|
||||
"icon": "flaticon2-drop text-waring"
|
||||
}, {
|
||||
"text": "Disabled Node",
|
||||
"icon": "fa fa-check text-success",
|
||||
"state": {
|
||||
"disabled": true
|
||||
}
|
||||
}, {
|
||||
"text": "Sub Nodes",
|
||||
"icon": "fa fa-folder text-danger",
|
||||
"children": [
|
||||
{"text": "Item 1", "icon" : "fa fa-file text-waring"},
|
||||
{"text": "Item 2", "icon" : "fa fa-file text-success"},
|
||||
{"text": "Item 3", "icon" : "fa fa-file text-default"},
|
||||
{"text": "Item 4", "icon" : "fa fa-file text-danger"},
|
||||
{"text": "Item 5", "icon" : "fa fa-file text-info"}
|
||||
]
|
||||
}]
|
||||
},
|
||||
"Another Node"
|
||||
]
|
||||
},
|
||||
"types" : {
|
||||
"default" : {
|
||||
"icon" : "fa fa-folder text-primary"
|
||||
},
|
||||
"file" : {
|
||||
"icon" : "fa fa-file text-primary"
|
||||
}
|
||||
},
|
||||
"state" : { "key" : "demo2" },
|
||||
"plugins" : [ "contextmenu", "state", "types" ]
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public Functions
|
||||
init: function() {
|
||||
exampleContextual();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTJSTreeContextual.init();
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTJSTreeCustomIcons = function() {
|
||||
// Private functions
|
||||
var exampleCustomIcons = function() {
|
||||
$('#kt_docs_jstree_customicons').jstree({
|
||||
"core" : {
|
||||
"themes" : {
|
||||
"responsive": false
|
||||
}
|
||||
},
|
||||
"types" : {
|
||||
"default" : {
|
||||
"icon" : "fa fa-folder text-warning"
|
||||
},
|
||||
"file" : {
|
||||
"icon" : "fa fa-file text-warning"
|
||||
}
|
||||
},
|
||||
"plugins": ["types"]
|
||||
});
|
||||
|
||||
// handle link clicks in tree nodes(support target="_blank" as well)
|
||||
$('#kt_docs_jstree_customicons').on('select_node.jstree', function(e,data) {
|
||||
var link = $('#' + data.selected).find('a');
|
||||
if (link.attr("href") != "#" && link.attr("href") != "javascript:;" && link.attr("href") != "") {
|
||||
if (link.attr("target") == "_blank") {
|
||||
link.attr("href").target = "_blank";
|
||||
}
|
||||
document.location.href = link.attr("href");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public Functions
|
||||
init: function() {
|
||||
exampleCustomIcons();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTJSTreeCustomIcons.init();
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTJSTreeDragDrop = function() {
|
||||
// Private functions
|
||||
var exampleDragDrop = function() {
|
||||
$("#kt_docs_jstree_dragdrop").jstree({
|
||||
"core" : {
|
||||
"themes" : {
|
||||
"responsive": false
|
||||
},
|
||||
// so that create works
|
||||
"check_callback" : true,
|
||||
'data': [{
|
||||
"text": "Parent Node",
|
||||
"children": [{
|
||||
"text": "Initially selected",
|
||||
"state": {
|
||||
"selected": true
|
||||
}
|
||||
}, {
|
||||
"text": "Custom Icon",
|
||||
"icon": "flaticon2-warning text-danger"
|
||||
}, {
|
||||
"text": "Initially open",
|
||||
"icon" : "fa fa-folder text-success",
|
||||
"state": {
|
||||
"opened": true
|
||||
},
|
||||
"children": [
|
||||
{"text": "Another node", "icon" : "fa fa-file text-waring"}
|
||||
]
|
||||
}, {
|
||||
"text": "Another Custom Icon",
|
||||
"icon": "flaticon2-bell-5 text-waring"
|
||||
}, {
|
||||
"text": "Disabled Node",
|
||||
"icon": "fa fa-check text-success",
|
||||
"state": {
|
||||
"disabled": true
|
||||
}
|
||||
}, {
|
||||
"text": "Sub Nodes",
|
||||
"icon": "fa fa-folder text-danger",
|
||||
"children": [
|
||||
{"text": "Item 1", "icon" : "fa fa-file text-waring"},
|
||||
{"text": "Item 2", "icon" : "fa fa-file text-success"},
|
||||
{"text": "Item 3", "icon" : "fa fa-file text-default"},
|
||||
{"text": "Item 4", "icon" : "fa fa-file text-danger"},
|
||||
{"text": "Item 5", "icon" : "fa fa-file text-info"}
|
||||
]
|
||||
}]
|
||||
},
|
||||
"Another Node"
|
||||
]
|
||||
},
|
||||
"types" : {
|
||||
"default" : {
|
||||
"icon" : "fa fa-folder text-success"
|
||||
},
|
||||
"file" : {
|
||||
"icon" : "fa fa-file text-success"
|
||||
}
|
||||
},
|
||||
"state" : { "key" : "demo2" },
|
||||
"plugins" : [ "dnd", "state", "types" ]
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
// Public Functions
|
||||
init: function() {
|
||||
exampleDragDrop();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTJSTreeDragDrop.init();
|
||||
});
|
||||
Reference in New Issue
Block a user