mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
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:
parent
b7e1797fd2
commit
f16f1d6537
@ -23,7 +23,7 @@ define(["notebook/js/widget"], function(widget_manager){
|
|||||||
|
|
||||||
// Called when view is rendered.
|
// Called when view is rendered.
|
||||||
render : function(){
|
render : function(){
|
||||||
this.$el = $('<div />')
|
this.$el
|
||||||
.addClass('widget-hbox-single');
|
.addClass('widget-hbox-single');
|
||||||
this.$label = $('<div />')
|
this.$label = $('<div />')
|
||||||
.addClass('widget-hlabel')
|
.addClass('widget-hlabel')
|
||||||
@ -74,7 +74,6 @@ define(["notebook/js/widget"], function(widget_manager){
|
|||||||
render : function(){
|
render : function(){
|
||||||
this.$el
|
this.$el
|
||||||
.html('');
|
.html('');
|
||||||
|
|
||||||
this.$button = $('<button />')
|
this.$button = $('<button />')
|
||||||
.addClass('btn')
|
.addClass('btn')
|
||||||
.attr('type', 'button')
|
.attr('type', 'button')
|
||||||
|
@ -30,6 +30,7 @@ define(["notebook/js/widget"], function(widget_manager){
|
|||||||
that.model.set('clicks', that.model.get('clicks') + 1);
|
that.model.set('clicks', that.model.get('clicks') + 1);
|
||||||
that.model.update_other_views(that);
|
that.model.update_other_views(that);
|
||||||
});
|
});
|
||||||
|
this._ensureElement();
|
||||||
|
|
||||||
this.update(); // Set defaults.
|
this.update(); // Set defaults.
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@ define(["notebook/js/widget"], function(widget_manager) {
|
|||||||
var ContainerView = IPython.WidgetView.extend({
|
var ContainerView = IPython.WidgetView.extend({
|
||||||
|
|
||||||
render: function(){
|
render: function(){
|
||||||
this.$el = $('<div />')
|
this.$el =
|
||||||
.addClass('widget-container');
|
.addClass('widget-container');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ define(["notebook/js/widget"], function(widget_manager){
|
|||||||
render: function(){
|
render: function(){
|
||||||
this.$el = $('<div />', {id: IPython.utils.uuid()})
|
this.$el = $('<div />', {id: IPython.utils.uuid()})
|
||||||
.addClass('accordion');
|
.addClass('accordion');
|
||||||
|
this._ensureElement();
|
||||||
this.containers = [];
|
this.containers = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -102,7 +103,6 @@ define(["notebook/js/widget"], function(widget_manager){
|
|||||||
var TabView = IPython.WidgetView.extend({
|
var TabView = IPython.WidgetView.extend({
|
||||||
|
|
||||||
render: function(){
|
render: function(){
|
||||||
this.$el = $('<div />');
|
|
||||||
var uuid = IPython.utils.uuid();
|
var uuid = IPython.utils.uuid();
|
||||||
var that = this;
|
var that = this;
|
||||||
this.$tabs = $('<div />', {id: uuid})
|
this.$tabs = $('<div />', {id: uuid})
|
||||||
|
@ -22,7 +22,6 @@ define(["notebook/js/widget"], function(widget_manager){
|
|||||||
|
|
||||||
// Called when view is rendered.
|
// Called when view is rendered.
|
||||||
render : function(){
|
render : function(){
|
||||||
this.$el = $('<div />');
|
|
||||||
this.update(); // Set defaults.
|
this.update(); // Set defaults.
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user