From fc6cb0231f046c4c52942f638d0efb7135bdd292 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Wed, 30 Oct 2013 13:44:59 -0700 Subject: [PATCH] Fixed checkbox click event handler --- IPython/html/static/notebook/js/widgets/bool.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/IPython/html/static/notebook/js/widgets/bool.js b/IPython/html/static/notebook/js/widgets/bool.js index 991e13538..60c3f33a6 100644 --- a/IPython/html/static/notebook/js/widgets/bool.js +++ b/IPython/html/static/notebook/js/widgets/bool.js @@ -14,8 +14,15 @@ require(["notebook/js/widget"], function(){ .addClass('widget-hlabel') .appendTo(this.$el) .hide(); + var that = this; this.$checkbox = $('') .attr('type', 'checkbox') + .click(function(el) { + that.user_invoked_update = true; + that.model.set('value', that.$checkbox.prop('checked')); + that.model.update_other_views(that); + that.user_invoked_update = false; + }) .appendTo(this.$el); this.update(); // Set defaults. @@ -38,15 +45,6 @@ require(["notebook/js/widget"], function(){ return IPython.WidgetView.prototype.update.call(this); }, - events: {"change input" : "handleChanged"}, - - // Handles and validates user input. - handleChanged: function(e) { - this.user_invoked_update = true; - this.model.set('value', $(e.target).prop('checked')); - this.model.update_other_views(this); - this.user_invoked_update = false; - }, }); IPython.notebook.widget_manager.register_widget_view('CheckboxView', CheckboxView);