Filterable Hierarchical Select Plugin For Bootstrap - Hierarchy Select

Filterable Hierarchical Select Plugin For Bootstrap - Hierarchy Select

Hierarchy Select is a lightweight jQuery plugin which converts the Bootstrap dropdown component into a filterable hierarchical dropdown list.

How to use it:

1. Download and include the jQuery Hierarchy Select plugin's files into your Bootstrap project.

<link rel="stylesheet" href="hierarchy-select.min.css">
<script src="hierarchy-select.min.js"></script>

2. Create a Bootstrap dropdown that uses data-level attribute to specify the data level for each list item.

<div class="btn-group hierarchy-select" data-resize="auto" id="demo">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
      <span class="selected-label pull-left">&nbsp;</span>
      <span class="caret"></span>
      <span class="sr-only">Toggle Dropdown</span>
  </button>
  <div class="dropdown-menu open">
      <div class="hs-searchbox">
          <input type="text" class="form-control" autocomplete="off">
      </div>
      <ul class="dropdown-menu inner" role="menu">
          <li data-value="" data-level="1" class="level-1 active">
              <a href="#">All categories</a>
          </li>
          <li data-value="1" data-level="1" class="level-1">
              <a href="#">Wine</a>
          </li>
          <li data-value="2" data-level="2" class="level-2">
              <a href="#">Color</a>
          </li>
          <li data-value="3" data-level="3" class="level-3">
              <a href="#">Red</a>
          </li>
          <li data-value="4" data-level="3" class="level-3">
              <a href="#">White</a>
          </li>
          <li data-value="5" data-level="3" class="level-3">
              <a href="#">Rose</a>
          </li>
          <li data-value="6" data-level="2" class="level-2">
              <a href="#">Country</a>
          </li>
          <li data-value="7" data-level="3" class="level-3">
              <a href="#">Marokko</a>
          </li>
          <li data-value="8" data-level="3" class="level-3">
              <a href="#">Russia</a>
          </li>
          <li data-value="9" data-level="2" class="level-2">
              <a href="#">Sugar Content</a>
          </li>
          <li data-value="10" data-level="3" class="level-3">
              <a href="#">Semi Sweet</a>
          </li>
          <li data-value="11" data-level="3" class="level-3">
              <a href="#">Brut</a>
          </li>
          <li data-value="12" data-level="2" class="level-2">
              <a href="#">Rating</a>
          </li>
          <li data-value="13" data-level="2" class="level-2">
              <a href="#">Grape Sort</a>
          </li>
          <li data-value="14" data-level="3" class="level-3">
              <a href="#">Riesling</a>
          </li>
          <li data-value="15" data-level="3" class="level-3">
              <a href="#">Aleatico</a>
          </li>
          <li data-value="16" data-level="3" class="level-3">
              <a href="#">Bouchet</a>
          </li>
          <li data-value="17" data-level="1" class="level-1">
              <a href="#">Whiskey</a>
          </li>
          <li data-value="18" data-level="2" class="level-2">
              <a href="#">Country</a>
          </li>
          <li data-value="19" data-level="3" class="level-3">
              <a href="#">Ireland</a>
          </li>
          <li data-value="20" data-level="3" class="level-3">
              <a href="#">Kanada</a>
          </li>
          <li data-value="21" data-level="3" class="level-3">
              <a href="#">Scotland</a>
          </li>
      </ul>
  </div>
  <input class="hidden hidden-field" name="search_form[category]" readonly aria-hidden="true" type="text"/>
</div>

3. Call the function hierarchySelect on the top element.

$('#demo').hierarchySelect();

4. Default plugin options.

$('#demo').hierarchySelect({
  // width/height
  width: 'auto',
  height: '208px',
  // enable hierarchical select
  hierarchy: false,
  // enable searchable select
  search: false
  
});

Change log:

2018-02-06

  • Bugfix

2017-06-03

  • Fix initSelect

2017-02-01

  • Prevent disabled or hidden element selection

2017-01-26

  • Add handlers for keys: Esc, Enter, Up, Down

This awesome jQuery plugin is developed by NeoFusion. For more Advanced Usages, please check the demo page or visit the official website.

  • Publication date: 06.02.2018
  • Source

Whoops, looks like something went wrong.

(1/1) ErrorException

file_put_contents(): Only 0 of 261 bytes written, possibly out of free disk space

in Filesystem.php (line 122)
at HandleExceptions->handleError(2, 'file_put_contents(): Only 0 of 261 bytes written, possibly out of free disk space', '/home/p336588/web/ivanovdmitry.com/public_html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 122, array('path' => '/home/p336588/web/ivanovdmitry.com/public_html/storage/framework/sessions/NSvrM2NezFGBJxKUg6CEwd8InLQGvRVuVEryJyjW', 'contents' => 'a:3:{s:6:"_token";s:40:"KvzgL6aFbHIvYpx7GOXNxd2ZdhWvu9FOeuxVSxAy";s:9:"_previous";a:1:{s:3:"url";s:102:"http://ivanovdmitry.com/blog/post/filterable-hierarchical-select-plugin-for-bootstrap-hierarchy-select";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 'lock' => true))
at file_put_contents('/home/p336588/web/ivanovdmitry.com/public_html/storage/framework/sessions/NSvrM2NezFGBJxKUg6CEwd8InLQGvRVuVEryJyjW', 'a:3:{s:6:"_token";s:40:"KvzgL6aFbHIvYpx7GOXNxd2ZdhWvu9FOeuxVSxAy";s:9:"_previous";a:1:{s:3:"url";s:102:"http://ivanovdmitry.com/blog/post/filterable-hierarchical-select-plugin-for-bootstrap-hierarchy-select";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 2)in Filesystem.php (line 122)
at Filesystem->put('/home/p336588/web/ivanovdmitry.com/public_html/storage/framework/sessions/NSvrM2NezFGBJxKUg6CEwd8InLQGvRVuVEryJyjW', 'a:3:{s:6:"_token";s:40:"KvzgL6aFbHIvYpx7GOXNxd2ZdhWvu9FOeuxVSxAy";s:9:"_previous";a:1:{s:3:"url";s:102:"http://ivanovdmitry.com/blog/post/filterable-hierarchical-select-plugin-for-bootstrap-hierarchy-select";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', true)in FileSessionHandler.php (line 83)
at FileSessionHandler->write('NSvrM2NezFGBJxKUg6CEwd8InLQGvRVuVEryJyjW', 'a:3:{s:6:"_token";s:40:"KvzgL6aFbHIvYpx7GOXNxd2ZdhWvu9FOeuxVSxAy";s:9:"_previous";a:1:{s:3:"url";s:102:"http://ivanovdmitry.com/blog/post/filterable-hierarchical-select-plugin-for-bootstrap-hierarchy-select";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}')in Store.php (line 128)
at Store->save()in StartSession.php (line 88)
at StartSession->terminate(object(Request), object(Response))in Kernel.php (line 218)
at Kernel->terminateMiddleware(object(Request), object(Response))in Kernel.php (line 189)
at Kernel->terminate(object(Request), object(Response))in index.php (line 58)