##// END OF EJS Templates
Make dropdown view DOM swap elements on update.
Jonathan Frederic -
Show More
@@ -68,14 +68,18 b' define(["notebook/js/widgets/widget"], function(widget_manager){'
68 }
68 }
69
69
70 var items = this.model.get('values');
70 var items = this.model.get('values');
71 this.$droplist.html('');
71 var $replace_droplist = $('<ul />')
72 .addClass('dropdown-menu');
72 for (var index in items) {
73 for (var index in items) {
73 var that = this;
74 var that = this;
74 var item_button = $('<a href="#"/>')
75 var item_button = $('<a href="#"/>')
75 .html(items[index])
76 .html(items[index])
76 .on('click', $.proxy(this.handle_click, this));
77 .on('click', $.proxy(this.handle_click, this));
77 this.$droplist.append($('<li />').append(item_button));
78 $replace_droplist.append($('<li />').append(item_button));
78 }
79 }
80 this.$droplist.replaceWith($replace_droplist);
81 this.$droplist.remove();
82 this.$droplist = $replace_droplist;
79
83
80 if (this.model.get('disabled')) {
84 if (this.model.get('disabled')) {
81 this.$buttongroup.attr('disabled','disabled');
85 this.$buttongroup.attr('disabled','disabled');
General Comments 0
You need to be logged in to leave comments. Login now