2
0

bootstrap-select.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. /*!
  2. * bootstrap-select v1.1.1
  3. * https://silviomoreto.github.io/bootstrap-select/
  4. *
  5. * Copyright 2013 bootstrap-select
  6. * Licensed under the MIT license
  7. */
  8. !function($) {
  9. "use strict";
  10. var Selectpicker = function(element, options, e) {
  11. if (e) {
  12. e.stopPropagation();
  13. e.preventDefault();
  14. }
  15. this.$element = $(element);
  16. this.$newElement = null;
  17. this.$button = null;
  18. this.$menu = null;
  19. //Merge defaults, options and data-attributes to make our options
  20. this.options = $.extend({}, $.fn.selectpicker.defaults, this.$element.data(), typeof options == 'object' && options);
  21. //If we have no title yet, check the attribute 'title' (this is missed by jq as its not a data-attribute
  22. if (this.options.title == null) {
  23. this.options.title = this.$element.attr('title');
  24. }
  25. //Expose public methods
  26. this.val = Selectpicker.prototype.val;
  27. this.render = Selectpicker.prototype.render;
  28. this.refresh = Selectpicker.prototype.refresh;
  29. this.setStyle = Selectpicker.prototype.setStyle;
  30. this.selectAll = Selectpicker.prototype.selectAll;
  31. this.deselectAll = Selectpicker.prototype.deselectAll;
  32. this.init();
  33. };
  34. Selectpicker.prototype = {
  35. constructor: Selectpicker,
  36. init: function(e) {
  37. this.$element.hide();
  38. this.multiple = this.$element.prop('multiple');
  39. var id = this.$element.attr('id');
  40. this.$newElement = this.createView();
  41. this.$element.after(this.$newElement);
  42. this.$menu = this.$newElement.find('> .dropdown-menu');
  43. this.$button = this.$newElement.find('> button');
  44. if (id !== undefined) {
  45. var _this = this;
  46. this.$button.attr('data-id', id);
  47. $('label[for="' + id + '"]').click(function() {
  48. _this.$button.focus();
  49. });
  50. }
  51. //If we are multiple, then add the show-tick class by default
  52. if (this.multiple) {
  53. this.$newElement.addClass('show-tick');
  54. }
  55. this.checkDisabled();
  56. this.checkTabIndex();
  57. this.clickListener();
  58. this.render();
  59. this.liHeight();
  60. this.setWidth();
  61. this.setStyle();
  62. if (this.options.container) {
  63. this.selectPosition();
  64. }
  65. this.$menu.data('this', this);
  66. this.$newElement.data('this', this);
  67. },
  68. createDropdown: function() {
  69. var drop =
  70. "<div class='btn-group bootstrap-select'>" +
  71. "<button type='button' class='dropdown-toggle' data-toggle='dropdown'>" +
  72. "<div class='item-dropdown--icon icon-reorder pull-right'></div>" +
  73. "<div class='filter-option pull-left'></div>&nbsp;" +
  74. "</button>" +
  75. "<div class='dropdown-menu open'>" +
  76. "<ul class='dropdown-menu inner' role='menu'>" +
  77. "</ul>" +
  78. "</div>" +
  79. "</div>";
  80. return $(drop);
  81. },
  82. createView: function() {
  83. var $drop = this.createDropdown();
  84. var $li = this.createLi();
  85. $drop.find('ul').append($li);
  86. return $drop;
  87. },
  88. reloadLi: function() {
  89. //Remove all children.
  90. this.destroyLi();
  91. //Re build
  92. var $li = this.createLi();
  93. this.$newElement.find('ul').append( $li );
  94. },
  95. destroyLi: function() {
  96. this.$newElement.find('li').remove();
  97. },
  98. createLi: function() {
  99. var _this = this,
  100. _liA = [],
  101. _liHtml = '';
  102. this.$element.find('option').each(function(index) {
  103. var $this = $(this);
  104. //Get the class and text for the option
  105. var optionClass = $this.attr("class") || '';
  106. var inline = $this.attr("style") || '';
  107. var text = $this.data('content') ? $this.data('content') : $this.html();
  108. var subtext = $this.data('subtext') !== undefined ? '<small class="muted">' + $this.data('subtext') + '</small>' : '';
  109. var icon = $this.data('icon') !== undefined ? '<i class="glyphicon '+$this.data('icon')+'"></i> ' : '';
  110. if (icon !== '' && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
  111. icon = '<span>'+icon+'</span>';
  112. }
  113. if (!$this.data('content')) {
  114. //Prepend any icon and append any subtext to the main text.
  115. text = icon + '<span class="text">' + text + subtext + '</span>';
  116. }
  117. if (_this.options.hideDisabled && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
  118. _liA.push('<a style="min-height: 0; padding: 0"></a>');
  119. } else if ($this.parent().is('optgroup') && $this.data('divider') != true) {
  120. if ($this.index() == 0) {
  121. //Get the opt group label
  122. var label = $this.parent().attr('label');
  123. var labelSubtext = $this.parent().data('subtext') !== undefined ? '<small class="muted">'+$this.parent().data('subtext')+'</small>' : '';
  124. var labelIcon = $this.parent().data('icon') ? '<i class="'+$this.parent().data('icon')+'"></i> ' : '';
  125. label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
  126. if ($this[0].index != 0) {
  127. _liA.push(
  128. '<div class="div-contain"><div class="divider"></div></div>'+
  129. '<dt>'+label+'</dt>'+
  130. _this.createA(text, "opt " + optionClass, inline )
  131. );
  132. } else {
  133. _liA.push(
  134. '<dt>'+label+'</dt>'+
  135. _this.createA(text, "opt " + optionClass, inline ));
  136. }
  137. } else {
  138. _liA.push( _this.createA(text, "opt " + optionClass, inline ) );
  139. }
  140. } else if ($this.data('divider') == true) {
  141. _liA.push('<div class="div-contain"><div class="divider"></div></div>');
  142. } else if ($(this).data('hidden') == true) {
  143. _liA.push('');
  144. } else {
  145. _liA.push( _this.createA(text, optionClass, inline ) );
  146. }
  147. });
  148. $.each(_liA, function(i, item) {
  149. _liHtml += "<li rel=" + i + ">" + item + "</li>";
  150. });
  151. //If we are not multiple, and we dont have a selected item, and we dont have a title, select the first element so something is set in the button
  152. if (!this.multiple && this.$element.find('option:selected').length==0 && !_this.options.title) {
  153. this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
  154. }
  155. return $(_liHtml);
  156. },
  157. createA: function(text, classes, inline) {
  158. return '<a tabindex="0" class="'+classes+'" style="'+inline+'">' +
  159. text +
  160. '<i class="glyphicon glyphicon-ok icon-ok check-mark"></i>' +
  161. '</a>';
  162. },
  163. render: function() {
  164. var _this = this;
  165. //Update the LI to match the SELECT
  166. this.$element.find('option').each(function(index) {
  167. _this.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled') );
  168. _this.setSelected(index, $(this).is(':selected') );
  169. });
  170. var selectedItems = this.$element.find('option:selected').map(function(index,value) {
  171. var $this = $(this);
  172. var icon = $this.data('icon') && _this.options.showIcon ? '<i class="glyphicon ' + $this.data('icon') + '"></i> ' : '';
  173. var subtext;
  174. if (_this.options.showSubtext && $this.attr('data-subtext') && !_this.multiple) {
  175. subtext = ' <small class="muted">'+$this.data('subtext') +'</small>';
  176. } else {
  177. subtext = '';
  178. }
  179. if ($this.data('content') && _this.options.showContent) {
  180. return $this.data('content');
  181. } else if ($this.attr('title') != undefined) {
  182. return $this.attr('title');
  183. } else {
  184. return icon + $this.html() + subtext;
  185. }
  186. }).toArray();
  187. //Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
  188. //Convert all the values into a comma delimited string
  189. var title = !this.multiple ? selectedItems[0] : selectedItems.join(", ");
  190. //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
  191. if (_this.multiple && _this.options.selectedTextFormat.indexOf('count') > -1) {
  192. var max = _this.options.selectedTextFormat.split(">");
  193. var notDisabled = this.options.hideDisabled ? ':not([disabled])' : '';
  194. if ( (max.length>1 && selectedItems.length > max[1]) || (max.length==1 && selectedItems.length>=2)) {
  195. title = _this.options.countSelectedText.replace('{0}', selectedItems.length).replace('{1}', this.$element.find('option:not([data-divider="true"]):not([data-hidden="true"])'+notDisabled).length);
  196. }
  197. }
  198. //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
  199. if (!title) {
  200. title = _this.options.title != undefined ? _this.options.title : _this.options.noneSelectedText;
  201. }
  202. _this.$newElement.find('.filter-option').html(title);
  203. },
  204. setStyle: function(style, status) {
  205. if (this.$element.attr('class')) {
  206. this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device/gi, ''));
  207. }
  208. var buttonClass = style ? style : this.options.style;
  209. if (status == 'add') {
  210. this.$button.addClass(buttonClass);
  211. } else {
  212. this.$button.removeClass(this.options.style);
  213. this.$button.addClass(buttonClass);
  214. }
  215. },
  216. liHeight: function() {
  217. var selectClone = this.$newElement.clone();
  218. selectClone.appendTo('body');
  219. var liHeight = selectClone.addClass('open').find('.dropdown-menu li > a').outerHeight();
  220. selectClone.remove();
  221. this.$newElement.data('liHeight', liHeight);
  222. },
  223. setSize: function() {
  224. var _this = this,
  225. menu = this.$menu,
  226. menuInner = menu.find('.inner'),
  227. menuA = menuInner.find('li > a'),
  228. selectHeight = this.$newElement.outerHeight(),
  229. liHeight = this.$newElement.data('liHeight'),
  230. divHeight = menu.find('li .divider').outerHeight(true),
  231. menuPadding = parseInt(menu.css('padding-top')) +
  232. parseInt(menu.css('padding-bottom')) +
  233. parseInt(menu.css('border-top-width')) +
  234. parseInt(menu.css('border-bottom-width')),
  235. notDisabled = this.options.hideDisabled ? ':not(.disabled)' : '',
  236. $window = $(window),
  237. menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2,
  238. menuHeight,
  239. selectOffsetTop,
  240. selectOffsetBot,
  241. posVert = function() {
  242. selectOffsetTop = _this.$newElement.offset().top - $window.scrollTop();
  243. selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
  244. };
  245. posVert();
  246. if (this.options.size == 'auto') {
  247. var getSize = function() {
  248. var minHeight;
  249. posVert();
  250. menuHeight = selectOffsetBot - menuExtras;
  251. _this.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && (menuHeight - menuExtras) < menu.height() && _this.options.dropupAuto);
  252. if (_this.$newElement.hasClass('dropup')) {
  253. menuHeight = selectOffsetTop - menuExtras;
  254. }
  255. if ((menu.find('li').length + menu.find('dt').length) > 3) {
  256. minHeight = liHeight*3 + menuExtras - 2;
  257. } else {
  258. minHeight = 0;
  259. }
  260. menu.css({'max-height' : menuHeight + 'px', 'overflow' : 'hidden', 'min-height' : minHeight + 'px'});
  261. menuInner.css({'max-height' : (menuHeight - menuPadding) + 'px', 'overflow-y' : 'auto', 'min-height' : (minHeight - menuPadding) + 'px'});
  262. }
  263. getSize();
  264. $(window).resize(getSize);
  265. $(window).scroll(getSize);
  266. } else if (this.options.size && this.options.size != 'auto' && menu.find('li'+notDisabled).length > this.options.size) {
  267. var optIndex = menu.find("li"+notDisabled+" > *").filter(':not(.div-contain)').slice(0,this.options.size).last().parent().index();
  268. var divLength = menu.find("li").slice(0,optIndex + 1).find('.div-contain').length;
  269. menuHeight = liHeight*this.options.size + divLength*divHeight + menuPadding;
  270. this.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && menuHeight < menu.height() && this.options.dropupAuto);
  271. menu.css({'max-height' : menuHeight + 'px', 'overflow' : 'hidden'});
  272. menuInner.css({'max-height' : (menuHeight - menuPadding) + 'px', 'overflow-y' : 'auto'});
  273. }
  274. },
  275. setWidth: function() {
  276. //Set width of select
  277. if (this.options.width == 'auto') {
  278. this.$menu.css('min-width','0');
  279. // Get correct width if element hidden
  280. var selectClone = this.$newElement.clone().appendTo('body');
  281. var ulWidth = selectClone.find('> .dropdown-menu').css('width');
  282. selectClone.remove();
  283. this.$newElement.css('width',ulWidth);
  284. } else if (this.options.width) {
  285. this.$newElement.css('width',this.options.width);
  286. }
  287. },
  288. selectPosition: function() {
  289. var _this = this,
  290. drop = "<div />",
  291. $drop = $(drop),
  292. pos,
  293. actualHeight,
  294. getPlacement = function($element) {
  295. $drop.addClass($element.attr('class')).toggleClass('dropup', $element.hasClass('dropup'));
  296. pos = $element.offset();
  297. actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
  298. $drop.css({'top' : pos.top + actualHeight, 'left' : pos.left, 'width' : $element[0].offsetWidth, 'position' : 'absolute'});
  299. };
  300. this.$newElement.on('click', function(e) {
  301. getPlacement($(this));
  302. $drop.appendTo(_this.options.container);
  303. $drop.toggleClass('open', !$(this).hasClass('open'));
  304. $drop.append(_this.$menu);
  305. });
  306. $(window).resize(function() {
  307. getPlacement(_this.$newElement);
  308. });
  309. $(window).on('scroll', function(e) {
  310. getPlacement(_this.$newElement);
  311. });
  312. $('html').on('click', function(e) {
  313. if ($(e.target).closest(_this.$newElement).length < 1) {
  314. $drop.removeClass('open');
  315. }
  316. });
  317. },
  318. mobile: function() {
  319. this.$element.addClass('mobile-device').appendTo(this.$newElement);
  320. if (this.options.container) this.$menu.hide();
  321. },
  322. refresh: function() {
  323. this.reloadLi();
  324. this.render();
  325. this.setWidth();
  326. this.setStyle();
  327. this.checkDisabled();
  328. },
  329. setSelected: function(index, selected) {
  330. this.$menu.find('li').eq(index).toggleClass('selected', selected);
  331. },
  332. setDisabled: function(index, disabled) {
  333. if (disabled) {
  334. this.$menu.find('li').eq(index).addClass('disabled').find('a').attr('href','#').attr('tabindex',-1);
  335. } else {
  336. this.$menu.find('li').eq(index).removeClass('disabled').find('a').removeAttr('href').attr('tabindex',0);
  337. }
  338. },
  339. isDisabled: function() {
  340. return this.$element.is(':disabled');
  341. },
  342. checkDisabled: function() {
  343. var _this = this;
  344. if (this.isDisabled()) {
  345. this.$button.addClass('disabled');
  346. this.$button.attr('tabindex','-1');
  347. } else if (this.$button.hasClass('disabled')) {
  348. this.$button.removeClass('disabled');
  349. this.$button.removeAttr('tabindex');
  350. }
  351. this.$button.click(function() {
  352. return !_this.isDisabled();
  353. });
  354. },
  355. checkTabIndex: function() {
  356. if (this.$element.is('[tabindex]')) {
  357. var tabindex = this.$element.attr("tabindex");
  358. this.$button.attr('tabindex', tabindex);
  359. }
  360. },
  361. clickListener: function() {
  362. var _this = this;
  363. $('body').on('touchstart.dropdown', '.dropdown-menu', function(e) {
  364. e.stopPropagation();
  365. });
  366. this.$newElement.on('click', function() {
  367. _this.setSize();
  368. });
  369. this.$menu.on('click', 'li a', function(e) {
  370. var clickedIndex = $(this).parent().index(),
  371. $this = $(this).parent(),
  372. prevValue = _this.$element.val();
  373. //Dont close on multi choice menu
  374. if (_this.multiple) {
  375. e.stopPropagation();
  376. }
  377. e.preventDefault();
  378. //Dont run if we have been disabled
  379. if (!_this.isDisabled() && !$(this).parent().hasClass('disabled')) {
  380. var $options = _this.$element.find('option');
  381. var $option = $options.eq(clickedIndex);
  382. //Deselect all others if not multi select box
  383. if (!_this.multiple) {
  384. $options.prop('selected', false);
  385. $option.prop('selected', true);
  386. }
  387. //Else toggle the one we have chosen if we are multi select.
  388. else {
  389. var state = $option.prop('selected');
  390. $option.prop('selected', !state);
  391. }
  392. _this.$button.focus();
  393. // Trigger select 'change'
  394. if (prevValue != _this.$element.val()) {
  395. _this.$element.change();
  396. }
  397. }
  398. });
  399. this.$menu.on('click', 'li.disabled a, li dt, li .div-contain', function(e) {
  400. e.preventDefault();
  401. e.stopPropagation();
  402. _this.$button.focus();
  403. });
  404. this.$element.change(function() {
  405. _this.render()
  406. });
  407. },
  408. val: function(value) {
  409. if (value != undefined) {
  410. this.$element.val( value );
  411. this.$element.change();
  412. return this.$element;
  413. } else {
  414. return this.$element.val();
  415. }
  416. },
  417. selectAll: function() {
  418. this.$element.find('option').prop('selected', true).attr('selected', 'selected');
  419. this.render();
  420. },
  421. deselectAll: function() {
  422. this.$element.find('option').prop('selected', false).removeAttr('selected');
  423. this.render();
  424. },
  425. keydown: function(e) {
  426. var $this,
  427. $items,
  428. $parent,
  429. index,
  430. next,
  431. first,
  432. last,
  433. prev,
  434. nextPrev,
  435. that;
  436. $this = $(this);
  437. $parent = $this.parent();
  438. that = $parent.data('this');
  439. if (that.options.container) $parent = that.$menu;
  440. $items = $('[role=menu] li:not(.divider):visible a', $parent);
  441. if (!$items.length) return;
  442. if (/(38|40)/.test(e.keyCode)) {
  443. index = $items.index($items.filter(':focus'));
  444. first = $items.parent(':not(.disabled)').first().index();
  445. last = $items.parent(':not(.disabled)').last().index();
  446. next = $items.eq(index).parent().nextAll(':not(.disabled)').eq(0).index();
  447. prev = $items.eq(index).parent().prevAll(':not(.disabled)').eq(0).index();
  448. nextPrev = $items.eq(next).parent().prevAll(':not(.disabled)').eq(0).index();
  449. if (e.keyCode == 38) {
  450. if (index != nextPrev && index > prev) index = prev;
  451. if (index < first) index = first;
  452. }
  453. if (e.keyCode == 40) {
  454. if (index != nextPrev && index < next) index = next;
  455. if (index > last) index = last;
  456. if (index == -1) index = 0;
  457. }
  458. $items.eq(index).focus();
  459. } else {
  460. var keyCodeMap = {
  461. 48:"0", 49:"1", 50:"2", 51:"3", 52:"4", 53:"5", 54:"6", 55:"7", 56:"8", 57:"9", 59:";",
  462. 65:"a", 66:"b", 67:"c", 68:"d", 69:"e", 70:"f", 71:"g", 72:"h", 73:"i", 74:"j", 75:"k", 76:"l",
  463. 77:"m", 78:"n", 79:"o", 80:"p", 81:"q", 82:"r", 83:"s", 84:"t", 85:"u", 86:"v", 87:"w", 88:"x", 89:"y", 90:"z",
  464. 96:"0", 97:"1", 98:"2", 99:"3", 100:"4", 101:"5", 102:"6", 103:"7", 104:"8", 105:"9"
  465. }
  466. var keyIndex = [];
  467. $items.each(function() {
  468. if ($(this).parent().is(':not(.disabled)')) {
  469. if ($.trim($(this).text().toLowerCase()).substring(0,1) == keyCodeMap[e.keyCode]) {
  470. keyIndex.push($(this).parent().index());
  471. }
  472. }
  473. });
  474. var count = $(document).data('keycount');
  475. count++;
  476. $(document).data('keycount',count);
  477. var prevKey = $.trim($(':focus').text().toLowerCase()).substring(0,1);
  478. if (prevKey != keyCodeMap[e.keyCode]) {
  479. count = 1;
  480. $(document).data('keycount',count);
  481. } else if (count >= keyIndex.length) {
  482. $(document).data('keycount',0);
  483. }
  484. $items.eq(keyIndex[count - 1]).focus();
  485. }
  486. // select focused option if "Enter" or "Spacebar" are pressed
  487. if (/(13|32)/.test(e.keyCode)) {
  488. $(':focus').click();
  489. if (!that.multiple) {
  490. $parent.parent().toggleClass('open', !(e.keyCode == 32));
  491. } else {
  492. e.preventDefault();
  493. };
  494. $(document).data('keycount',0);
  495. }
  496. },
  497. hide: function() {
  498. this.$newElement.hide();
  499. },
  500. show: function() {
  501. this.$newElement.show();
  502. },
  503. destroy: function() {
  504. this.$newElement.remove();
  505. this.$element.remove();
  506. }
  507. };
  508. $.fn.selectpicker = function(option, event) {
  509. //get the args of the outer function..
  510. var args = arguments;
  511. var value;
  512. var chain = this.each(function() {
  513. if ($(this).is('select')) {
  514. var $this = $(this),
  515. data = $this.data('selectpicker'),
  516. options = typeof option == 'object' && option;
  517. if (!data) {
  518. $this.data('selectpicker', (data = new Selectpicker(this, options, event)));
  519. } else if (options) {
  520. for(var i in options) {
  521. data.options[i] = options[i];
  522. }
  523. }
  524. if (typeof option == 'string') {
  525. //Copy the value of option, as once we shift the arguments
  526. //it also shifts the value of option.
  527. var property = option;
  528. if (data[property] instanceof Function) {
  529. [].shift.apply(args);
  530. value = data[property].apply(data, args);
  531. } else {
  532. value = data.options[property];
  533. }
  534. }
  535. }
  536. });
  537. if (value != undefined) {
  538. return value;
  539. } else {
  540. return chain;
  541. }
  542. };
  543. $.fn.selectpicker.defaults = {
  544. style: null,
  545. size: 'auto',
  546. title: null,
  547. selectedTextFormat : 'values',
  548. noneSelectedText : 'Nothing selected',
  549. countSelectedText: '{0} of {1} selected',
  550. width: null,
  551. container: false,
  552. hideDisabled: false,
  553. showSubtext: false,
  554. showIcon: true,
  555. showContent: true,
  556. dropupAuto: true
  557. }
  558. $(document)
  559. .data('keycount', 0)
  560. .on('keydown', '[data-toggle=dropdown], [role=menu]' , Selectpicker.prototype.keydown)
  561. }(window.jQuery);