in clns-acuity-admin/acuity-core/src/main/resources/public/js/js-lib/bootstrap-select-v1.6.3/js/bootstrap-select.js [358:417]
render: function (updateLi) {
var that = this;
//Update the LI to match the SELECT
if (updateLi !== false) {
this.$element.find('option').each(function (index) {
that.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled'));
that.setSelected(index, $(this).is(':selected'));
});
}
this.tabIndex();
var notDisabled = this.options.hideDisabled ? ':not([disabled])' : '';
var selectedItems = this.$element.find('option:selected' + notDisabled).map(function () {
var $this = $(this);
var icon = $this.data('icon') && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '';
var subtext;
if (that.options.showSubtext && $this.attr('data-subtext') && !that.multiple) {
subtext = ' <small class="muted text-muted">' + $this.data('subtext') + '</small>';
} else {
subtext = '';
}
if ($this.data('content') && that.options.showContent) {
return $this.data('content');
} else if (typeof $this.attr('title') !== 'undefined') {
return $this.attr('title');
} else {
return icon + $this.html() + subtext;
}
}).toArray();
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
//Convert all the values into a comma delimited string
var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator);
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
var max = this.options.selectedTextFormat.split('>');
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) {
notDisabled = this.options.hideDisabled ? ', [disabled]' : '';
var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length,
tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText;
title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString());
}
}
this.options.title = this.$element.attr('title');
if (this.options.selectedTextFormat == 'static') {
title = this.options.title;
}
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
if (!title) {
title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText;
}
this.$button.attr('title', htmlEscape(title));
this.$newElement.find('.filter-option').html(title);
},