comment model.set, so we know that it triggers update on other views

This commit is contained in:
Jonathan Frederic 2014-01-08 10:54:33 +00:00
parent ccbfcbc159
commit c4edfdc828
4 changed files with 30 additions and 0 deletions

View File

@ -34,6 +34,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
.attr('type', 'checkbox')
.click(function(el) {
that.user_invoked_update = true;
// Calling model.set will trigger all of the other views of the
// model to update.
that.model.set('value', that.$checkbox.prop('checked'));
that.touch();
that.user_invoked_update = false;
@ -116,6 +119,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handles and validates user input.
handleClick: function(e) {
this.user_invoked_update = true;
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', ! $(e.target).hasClass('active'));
this.touch();
this.user_invoked_update = false;

View File

@ -96,6 +96,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
.attr('data-parent', '#' + this.$el.attr('id'))
.attr('href', '#' + uuid)
.click(function(evt){
// Calling model.set will trigger all of the other views of the
// model to update.
that.model.set("selected_index", index);
that.touch();
})
@ -194,6 +197,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
.html('Page ' + index)
.appendTo(tab)
.click(function (e) {
// Calling model.set will trigger all of the other views of the
// model to update.
that.model.set("selected_index", index);
that.touch();
that.select_page(index);

View File

@ -104,6 +104,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handle when a value is clicked.
handle_click: function (e) {
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).html(), this);
this.touch();
},
@ -193,6 +196,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handle when a value is clicked.
handle_click: function (e) {
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).val(), this);
this.touch();
},
@ -277,6 +283,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handle when a value is clicked.
handle_click: function (e) {
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).html(), this);
this.touch();
},
@ -358,6 +367,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handle when a value is clicked.
handle_click: function (e) {
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', $(e.target).html(), this);
this.touch();
},

View File

@ -124,6 +124,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handles and validates user input.
handleChanging: function(e) {
this.user_invoked_update = true;
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', e.target.value);
this.touch();
this.user_invoked_update = false;
@ -180,6 +183,9 @@ define(["notebook/js/widgets/widget"], function(widget_manager){
// Handles and validates user input.
handleChanging: function(e) {
// Calling model.set will trigger all of the other views of the
// model to update.
this.model.set('value', e.target.value);
this.touch();
},