fuzzySearch.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <TITLE> ZTREE DEMO - fuzzySearch</TITLE>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  6. <link rel="stylesheet" href="../../../css/demo.css" type="text/css">
  7. <link rel="stylesheet" href="../../../css/zTreeStyle/zTreeStyle.css" type="text/css">
  8. <script type="text/javascript" src="../../../js/jquery.min.js"></script>
  9. <!-- <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script>-->
  10. <script type="text/javascript" src="../../../js/jquery.ztree.core.js"></script>
  11. <script type="text/javascript" src="../../../js/jquery.ztree.exhide.js"></script>
  12. <script type="text/javascript" src="../../js/fuzzysearch.js"></script>
  13. <SCRIPT type="text/javascript">
  14. var setting = {
  15. check: {
  16. enable: true//checkbox
  17. },
  18. view: {
  19. nameIsHTML: true, //allow html in node name for highlight use
  20. selectedMulti: false
  21. },
  22. edit: {
  23. enable: false,
  24. editNameSelectAll: false
  25. },
  26. data: {
  27. simpleData: {
  28. enable: true
  29. }
  30. }
  31. };
  32. var zNodes =[
  33. { id:1, pId:0, name:"fuzzySearch demo 1", t:"id=1", open:true},
  34. { id:11, pId:1, name:"[]\\^$.|?*+():keywords with js meta characters", t:"id=11"},
  35. { id:12, pId:1, name:"{}<>'\"~`!@#%&-;:/,=:keywords with other characters", t:"id=12"},
  36. { id:2, pId:0, name:"fuzzySearch demo 2", t:"id=2", open:true},
  37. { id:21, pId:2, name:"uppercase ABDEFGHINQRT:keywords igonore case", t:"id=21"},
  38. { id:22, pId:2, name:"lowercase abdefghinqrt:keywords igonore case", t:"id=21"},
  39. { id:3, pId:0, name:"fuzzySearch demo 3", t:"id=3", open:true },
  40. { id:31, pId:3, name:"blank blank:keywords with blank", t:"id=31"}
  41. ];
  42. $(document).ready(function(){
  43. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  44. fuzzySearch('treeDemo','#key',null,true); //initialize fuzzysearch function
  45. });
  46. //-->
  47. </SCRIPT>
  48. </HEAD>
  49. <BODY>
  50. <h1>Fuzzy Search</h1>
  51. <h6>[ File Path: fuzzySearch/fuzzySearch.html ]</h6>
  52. <div class="content_wrap">
  53. <div class="zTreeDemoBackground left">
  54. <ul id="treeDemo" class="ztree"></ul>
  55. </div>
  56. <div class="right">
  57. <ul class="info">
  58. <li class="title">
  59. <h2>1. Explaination of fuzzySearch()</h2>
  60. <ul class="list">
  61. <li class="highlight_red">
  62. @param the ztree id used to get the ztree object
  63. </li>
  64. <li class="highlight_red">
  65. @param searchField selector of your input for fuzzy search
  66. </li>
  67. <li class="highlight_red">
  68. @param isHighLight whether highlight the match words, default true
  69. </li>
  70. <li class="highlight_red">
  71. @param isExpand whether to expand the node, default false
  72. </li>
  73. <li class="highlight_red">
  74. fuzzySearch ( zTreeId, searchField, isHighLight, isExpand )
  75. </li>
  76. <li><p>Try to search:<br/>
  77. Keywords:<input type="text" id="key" value="" class="empty" /><br/>
  78. </p>
  79. </li>
  80. </ul>
  81. </li>
  82. <li class="title"><h2>2. js dependencies</h2>
  83. <ul class="list">
  84. <li>ztree v3.5.19.1 +, getPath() in use</li>
  85. <li>ztree.exhide extension, hideNode() in use</li>
  86. </ul>
  87. </li>
  88. </ul>
  89. </div>
  90. </div>
  91. </BODY>
  92. </HTML>