Make sure backbone events fire.

If $el is set to something else, make sure all the backbone machinery
knows about the new DOM element.
This commit is contained in:
Jonathan Frederic 2013-11-20 21:36:03 +00:00
parent b7e1797fd2
commit f16f1d6537
5 changed files with 4 additions and 5 deletions

View File

@ -23,7 +23,7 @@ define(["notebook/js/widget"], function(widget_manager){
// Called when view is rendered.
render : function(){
this.$el = $('<div />')
this.$el
.addClass('widget-hbox-single');
this.$label = $('<div />')
.addClass('widget-hlabel')
@ -74,7 +74,6 @@ define(["notebook/js/widget"], function(widget_manager){
render : function(){
this.$el
.html('');
this.$button = $('<button />')
.addClass('btn')
.attr('type', 'button')

View File

@ -30,6 +30,7 @@ define(["notebook/js/widget"], function(widget_manager){
that.model.set('clicks', that.model.get('clicks') + 1);
that.model.update_other_views(that);
});
this._ensureElement();
this.update(); // Set defaults.
},

View File

@ -21,7 +21,7 @@ define(["notebook/js/widget"], function(widget_manager) {
var ContainerView = IPython.WidgetView.extend({
render: function(){
this.$el = $('<div />')
this.$el =
.addClass('widget-container');
},

View File

@ -23,6 +23,7 @@ define(["notebook/js/widget"], function(widget_manager){
render: function(){
this.$el = $('<div />', {id: IPython.utils.uuid()})
.addClass('accordion');
this._ensureElement();
this.containers = [];
},
@ -102,7 +103,6 @@ define(["notebook/js/widget"], function(widget_manager){
var TabView = IPython.WidgetView.extend({
render: function(){
this.$el = $('<div />');
var uuid = IPython.utils.uuid();
var that = this;
this.$tabs = $('<div />', {id: uuid})

View File

@ -22,7 +22,6 @@ define(["notebook/js/widget"], function(widget_manager){
// Called when view is rendered.
render : function(){
this.$el = $('<div />');
this.update(); // Set defaults.
},