##// END OF EJS Templates
Fixed checkbox click event handler
Jonathan Frederic -
Show More
@@ -14,8 +14,15 b' require(["notebook/js/widget"], function(){'
14 14 .addClass('widget-hlabel')
15 15 .appendTo(this.$el)
16 16 .hide();
17 var that = this;
17 18 this.$checkbox = $('<input />')
18 19 .attr('type', 'checkbox')
20 .click(function(el) {
21 that.user_invoked_update = true;
22 that.model.set('value', that.$checkbox.prop('checked'));
23 that.model.update_other_views(that);
24 that.user_invoked_update = false;
25 })
19 26 .appendTo(this.$el);
20 27
21 28 this.update(); // Set defaults.
@@ -38,15 +45,6 b' require(["notebook/js/widget"], function(){'
38 45 return IPython.WidgetView.prototype.update.call(this);
39 46 },
40 47
41 events: {"change input" : "handleChanged"},
42
43 // Handles and validates user input.
44 handleChanged: function(e) {
45 this.user_invoked_update = true;
46 this.model.set('value', $(e.target).prop('checked'));
47 this.model.update_other_views(this);
48 this.user_invoked_update = false;
49 },
50 48 });
51 49
52 50 IPython.notebook.widget_manager.register_widget_view('CheckboxView', CheckboxView);
General Comments 0
You need to be logged in to leave comments. Login now