mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-13 13:17:50 +08:00
Added apply method to base model.
Allows model to propogate changes to all views except for the one specified.
This commit is contained in:
parent
50213707ea
commit
3e36dd0c92
@ -25,7 +25,18 @@ var IPython = (function (IPython) {
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// WidgetModel class
|
// WidgetModel class
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
var WidgetModel = Backbone.Model.extend({});
|
var WidgetModel = Backbone.Model.extend({
|
||||||
|
apply: function(sender) {
|
||||||
|
this.save();
|
||||||
|
|
||||||
|
for (var index in this.views) {
|
||||||
|
var view = this.views[index];
|
||||||
|
if (view !== sender) {
|
||||||
|
view.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@ -214,7 +225,6 @@ var IPython = (function (IPython) {
|
|||||||
clear_output : $.proxy(outputarea.handle_clear_output, outputarea)}
|
clear_output : $.proxy(outputarea.handle_clear_output, outputarea)}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var model_json = model.toJSON();
|
var model_json = model.toJSON();
|
||||||
var data = {sync_method: method, sync_data: model_json};
|
var data = {sync_method: method, sync_data: model_json};
|
||||||
comm.send(data, callbacks);
|
comm.send(data, callbacks);
|
||||||
|
Loading…
Reference in New Issue
Block a user