Commit 778c55c0 authored by David Stutz's avatar David Stutz

Merge pull request #440 from Tyf0x/fix_#430

** fix for #430 **
parents ac27183f faf44019
.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li.multiselect-group label{margin:0;padding:3px 20px;height:100%;font-weight:700}.multiselect-container>li.multiselect-group-clickable label{cursor:pointer}.multiselect-container>li>a{padding:0}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400;padding:3px 20px 3px 40px}.multiselect-container>li>a>label.radio,.multiselect-container>li>a>label.checkbox{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.filter .btn{padding:6px 3px}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.form-inline .multiselect-container label.checkbox,.form-inline .multiselect-container label.radio{padding:3px 20px 3px 40px}.form-inline .multiselect-container li a label.checkbox input[type=checkbox],.form-inline .multiselect-container li a label.radio input[type=radio]{margin-left:-20px;margin-right:0} .multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li.multiselect-group label{margin:0;padding:3px 20px;height:100%;font-weight:700}.multiselect-container>li.multiselect-group-clickable label{cursor:pointer}.multiselect-container>li>a{padding:0}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400;padding:3px 20px 3px 40px}.multiselect-container>li>a>label.radio,.multiselect-container>li>a>label.checkbox{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.filter .btn{padding:6px 3px}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.form-inline .multiselect-container label.checkbox,.form-inline .multiselect-container label.radio{padding:3px 20px 3px 40px}.form-inline .multiselect-container li a label.checkbox input[type=checkbox],.form-inline .multiselect-container li a label.radio input[type=radio]{margin-left:-20px;margin-right:0}.multiselect .multiselect-selected-text{max-width:100%;display:inline-block;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;}.multiselect .caret{margin:auto;display:block;}
\ No newline at end of file \ No newline at end of file
...@@ -151,23 +151,23 @@ ...@@ -151,23 +151,23 @@
*/ */
buttonText: function(options, select) { buttonText: function(options, select) {
if (options.length === 0) { if (options.length === 0) {
return this.nonSelectedText + ' <b class="caret"></b>'; return this.nonSelectedText;
} }
else if (options.length == $('option', $(select)).length) { else if (options.length == $('option', $(select)).length) {
return this.allSelectedText + ' <b class="caret"></b>'; return this.allSelectedText;
} }
else if (options.length > this.numberDisplayed) { else if (options.length > this.numberDisplayed) {
return options.length + ' ' + this.nSelectedText + ' <b class="caret"></b>'; return options.length + ' ' + this.nSelectedText;
} }
else { else {
var selected = ''; var selected = '';
options.each(function() { options.each(function() {
var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).html(); var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text();
selected += label + ', '; selected += label + ', ';
}); });
return selected.substr(0, selected.length - 2) + ' <b class="caret"></b>'; return selected.substr(0, selected.length - 2);
} }
}, },
/** /**
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
* @returns {String} * @returns {String}
*/ */
label: function(element){ label: function(element){
return $(element).attr('label') || $(element).html(); return $(element).attr('label') || $(element).text();
}, },
/** /**
* Triggered on change of the multiselect. * Triggered on change of the multiselect.
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
numberDisplayed: 3, numberDisplayed: 3,
disableIfEmpty: false, disableIfEmpty: false,
templates: { templates: {
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"></button>', button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
ul: '<ul class="multiselect-container dropdown-menu"></ul>', ul: '<ul class="multiselect-container dropdown-menu"></ul>',
filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>', filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>', filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>',
...@@ -1211,7 +1211,7 @@ ...@@ -1211,7 +1211,7 @@
var options = this.getSelected(); var options = this.getSelected();
// First update the displayed button text. // First update the displayed button text.
$('.multiselect', this.$container).html(this.options.buttonText(options, this.$select)); $('.multiselect .multiselect-selected-text', this.$container).text(this.options.buttonText(options, this.$select));
// Now update the title attribute of the button. // Now update the title attribute of the button.
$('.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select)); $('.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment