Fixed context of onclick callbacks selection widget views

This commit is contained in:
Jonathan Frederic 2013-12-12 20:47:37 +00:00
parent 4e3b2b3e94
commit 5678617d8f

View File

@ -74,7 +74,7 @@ define(["notebook/js/widget"], function(widget_manager){
var that = this; var that = this;
var item_button = $('<a href="#"/>') var item_button = $('<a href="#"/>')
.html(items[index]) .html(items[index])
.on('click', this.handle_click); .on('click', $.proxy(this.handle_click, this));
this.$droplist.append($('<li />').append(item_button)); this.$droplist.append($('<li />').append(item_button));
} }
@ -149,7 +149,7 @@ define(["notebook/js/widget"], function(widget_manager){
.addClass(this.model) .addClass(this.model)
.val(items[index]) .val(items[index])
.prependTo($label) .prependTo($label)
.on('click', this.handle_click); .on('click', $.proxy(this.handle_click, this));
} }
var $item_element = this.$container.find(item_query); var $item_element = this.$container.find(item_query);
@ -231,7 +231,7 @@ define(["notebook/js/widget"], function(widget_manager){
.addClass('btn') .addClass('btn')
.html(items[index]) .html(items[index])
.appendTo(this.$buttongroup) .appendTo(this.$buttongroup)
.on('click', this.handle_click); .on('click', $.proxy(this.handle_click, this));
} }
var $item_element = this.$buttongroup.find(item_query); var $item_element = this.$buttongroup.find(item_query);
@ -311,7 +311,7 @@ define(["notebook/js/widget"], function(widget_manager){
.html(items[index]) .html(items[index])
.attr('value', items[index]) .attr('value', items[index])
.appendTo(this.$listbox) .appendTo(this.$listbox)
.on('click', this.handle_click); .on('click', $.proxy(this.handle_click, this));
} }
} }