userTreeList.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <script>
  3. $(document).ready(function() {
  4. var to = false;
  5. $('#search_q').keyup(function () {
  6. if(to) { clearTimeout(to); }
  7. to = setTimeout(function () {
  8. var v = $('#search_q').val();
  9. $('#userJsTree').jstree(true).search(v);
  10. }, 250);
  11. });
  12. $('#userJsTree').jstree({
  13. 'core' : {
  14. "multiple" : false,
  15. "animation" : 0,
  16. "loaded_state" : true,
  17. "themes" : { "variant" : "large", "icons":true , "stripes":true},
  18. 'data' : {
  19. "url" : "${ctx}/leader/org/leaderOrgNo/treeData",
  20. "dataType" : "json"
  21. }
  22. },
  23. "conditionalselect" : function (node, event) {
  24. return false;
  25. },
  26. 'plugins': ["state",'types', 'wholerow', "search"],
  27. "types":{
  28. 'default' : { 'icon' : 'fa fa-folder' },
  29. '1' : {'icon' : 'fa fa-home'},
  30. '2' : {'icon' : 'fa fa-umbrella' },
  31. '3' : { 'icon' : 'fa fa-group'},
  32. '4' : { 'icon' : 'fa fa-file-text-o' }
  33. }
  34. }).bind("activate_node.jstree", function (obj, e) {
  35. var node = $('#userJsTree').jstree(true).get_selected(true)[0];
  36. var opt = {
  37. silent: true,
  38. query:{
  39. 'officeId':node.id
  40. }
  41. };
  42. var id = node.id == '0' ? '' :node.id;
  43. $("#officeId").val(id);
  44. $("#officeName").val(node.text);
  45. $('#table').bootstrapTable('refresh');
  46. }).on('loaded.jstree', function() {
  47. //$("#carKind1jsTree").jstree('open_all');
  48. });
  49. });
  50. function refreshTree() {
  51. $('#userJsTree').jstree("refresh");
  52. }
  53. </script>