From e5b411d430a94a6abc0a17a3c4809ad471a0649b Mon Sep 17 00:00:00 2001 From: Hypnos <12692680+Hypnos3@users.noreply.github.com> Date: Mon, 30 Sep 2019 15:40:06 +0200 Subject: [PATCH] fix template.liGroup , added indeterminate option for group checkboxes - added indeterminate option to group checkboxes - fixed problem with liGroup template - added liGroupCaret template for Bootstrap 4 compatibility - added to let option classes set to group checkboxes --- dist/js/bootstrap-multiselect.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dist/js/bootstrap-multiselect.js b/dist/js/bootstrap-multiselect.js index 2a028b77..cb1c5311 100644 --- a/dist/js/bootstrap-multiselect.js +++ b/dist/js/bootstrap-multiselect.js @@ -445,8 +445,9 @@ filterClearBtn: '', li: '
  • ', divider: '
  • ', - liGroup: '
  • ', resetButton: '
  • ' + liGroup: '
  • ', + liGroupCaret: '' } }, @@ -945,7 +946,8 @@ createOptgroup: function(group) { var label = $(group).attr("label"); var value = $(group).attr("value"); - var $li = $('
  • '); + var ipclass = $(group).attr("class"); + var $li = $(this.options.templates.liGroup); var classes = this.options.optionClass(group); $li.addClass(classes); @@ -958,11 +960,11 @@ } if (this.options.enableCollapsibleOptGroups && this.options.multiple) { - $('a', $li).append(''); + $('a', $li).append(this.options.templates.liGroupCaret); } if (this.options.enableClickableOptGroups && this.options.multiple) { - $('a label', $li).prepend(''); + $('a label', $li).prepend(''); } if ($(group).is(':disabled')) { @@ -1617,14 +1619,19 @@ .not('.disabled'); var checked = true; + var checkedCount = 0; $options.each(function() { var $input = $('input', this); if (!$input.prop('checked')) { checked = false; + } else { + checkedCount++; } }); + $('input', this).prop('indeterminate', (!checked && checkedCount > 0)); + if (selectedClass) { if (checked) { $(this).addClass(selectedClass);