fuzzySearch.html 3.0 KB

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