jstreeAJAX.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. $('#treeAjaxHTML').jstree({
  2. 'core': {
  3. 'themes': {
  4. 'responsive': false
  5. },
  6. 'check_callback': true,
  7. 'data': {
  8. 'url': './script/php/treeJs_getPath.php',
  9. }
  10. },
  11. 'types': {
  12. 'default': {
  13. 'icon': 'fa fa-folder'
  14. },
  15. 'file': {
  16. 'icon': 'fa fa-file'
  17. }
  18. },
  19. 'plugins': ['types']
  20. }).on(
  21. 'select_node.jstree',
  22. function (event, data) {
  23. if (data.node.text.includes(".")) {
  24. window.location.href = data.node.a_attr.href;
  25. //console.log(data);
  26. }
  27. }).bind('loaded.jstree', function (e, data) {
  28. // invoked after jstree has loaded
  29. $('.jstree-anchor').each(function (index) {
  30. if ($(this).attr('href').includes(".dll") || $(this).attr('href').includes(".dyn")) {
  31. api = $(this).attr('href');
  32. }
  33. });
  34. if (api != null) {
  35. var fileNames = api.split("/");
  36. fileName = fileNames[fileNames.length - 1];
  37. $("#api").attr("href", api)
  38. $("#api").append(fileName);
  39. }
  40. });