You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sidebar-search.md 2.1KB

3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ---
  2. layout: page
  3. title: Sidebar Search Plugin
  4. ---
  5. The sidebar search plugin provides the functionality to search menu items from the sidebar menu entries.
  6. ##### Usage
  7. This plugin can be activated as a jQuery plugin or using the data API.
  8. ###### Data API
  9. {: .text-bold }
  10. Activate the plugin by adding the following data-attribue `data-widget="sidebar-search"` to a input-group inside the
  11. sidebar. You can use the HTML Markup below for a quick start.
  12. ###### jQuery
  13. {: .text-bold }
  14. The jQuery API provides more customizable options that allows the developer to pre-process the request before rendering
  15. and post-process it after rendering.
  16. ```js
  17. ("[data-widget="
  18. sidebar - search
  19. "]"
  20. ).
  21. SidebarSearch(options)
  22. ```
  23. ##### HTML Markup
  24. Place this HTML Markup after `div.user-panel`.
  25. ```html
  26. <div class="form-inline">
  27. <div class="input-group" data-widget="sidebar-search">
  28. <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
  29. <div class="input-group-append">
  30. <button class="btn btn-sidebar">
  31. <i class="fas fa-search fa-fw"></i>
  32. </button>
  33. </div>
  34. </div>
  35. </div>
  36. ```
  37. ##### Options
  38. {: .mt-4}
  39. |---
  40. | Name | Type | Default | Description
  41. |-|-|-|-
  42. | arrowSign | String | '->' | Arrow Sign between the menu item path.
  43. | minLength | Number | 3 | Min search query length.
  44. | maxResults | Number | 7 | Max search results to display.
  45. | highlightName | Boolean | TRUE | Whether to highlight menu item name.
  46. | highlightPath | Boolean | FALSE | Whether to highlight menu item path.
  47. | highlightClass | String | 'text-light' | Hightlight class.
  48. | notFoundText | String | 'No element found! | Response text if no menu item found.
  49. {: .table .table-bordered .bg-light}
  50. ##### Methods
  51. {: .mt-4}
  52. |---
  53. | Method | Description
  54. |-|-
  55. |init | Init's the SidebarSearch Plugin and registers all visible menu items.
  56. |toggle | Toggles the search dropdown list.
  57. |close | Closes the search dropdown list.
  58. |open | Opens the search dropdown list.
  59. |search | Triggers a search.
  60. {: .table .table-bordered .bg-light}
  61. Example: `$('[data-widget="sidebar-search"]').SidebarSearch('toggle')`