Better fix for empty dropdown button alignment

Now an   character is inserted and bootstrap is left alone to deal with alignment.
This commit is contained in:
Jonathan Frederic 2013-11-14 18:09:17 +00:00
parent 67e15f79db
commit e6aa364976
2 changed files with 10 additions and 2 deletions

View File

@ -22,10 +22,12 @@ define(["notebook/js/widget"], function(){
this.$droplabel = $('<button />')
.addClass('btn')
.addClass('widget-combo-btn')
.html('&nbsp;')
.appendTo(this.$buttongroup);
this.$dropbutton = $('<button />')
.addClass('btn')
.addClass('dropdown-toggle')
.addClass('widget-combo-carrot-btn')
.attr('data-toggle', 'dropdown')
.html('<span class="caret"></span>')
.appendTo(this.$buttongroup);
@ -40,7 +42,14 @@ define(["notebook/js/widget"], function(){
// Handles: Backend -> Frontend Sync
// Frontent -> Frontend Sync
update : function(){
this.$droplabel.html(this.model.get('value'));
var selected_item_text = this.model.get('value');
selected_item_text.replace(' ', '');
if (selected_item_text == '') {
this.$droplabel.html('&nbsp;');
} else {
this.$droplabel.html(this.model.get('value'));
}
var items = this.model.get('values');
this.$droplist.html('');

View File

@ -98,7 +98,6 @@
.widget-combo-btn {
min-width: 138px; /* + 26px drop arrow btn = 164px */
min-height: 1ex;
}
.widget-container {