diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 4ce2a04..2caf223 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -24,6 +24,7 @@ define(["widgets/js/manager", * An ID unique to this model. * comm : Comm instance (optional) */ + WidgetModel.__super__.constructor.apply(this); this.widget_manager = widget_manager; this.state_change = Promise.resolve(); this._buffered_state_diff = {}; @@ -32,6 +33,13 @@ define(["widgets/js/manager", this.state_lock = null; this.id = model_id; this.views = {}; + + // Force backbone to think that the model has already been + // synced with the server. As of backbone 1.1, backbone + // ignores `patch` if it thinks the model has never been + // pushed. + this.isNew = function() { return false; }; + this._resolve_received_state = {}; if (comm !== undefined) { diff --git a/IPython/html/tests/widgets/widget.js b/IPython/html/tests/widgets/widget.js index d3c6b6d..989eaef 100644 --- a/IPython/html/tests/widgets/widget.js +++ b/IPython/html/tests/widgets/widget.js @@ -115,7 +115,7 @@ casper.notebook_test(function () { var multiset = {}; multiset.index = this.append_cell( 'from IPython.utils.traitlets import Unicode, CInt\n' + - 'class MultiSetWidget(widgets.Widget):\n' + + 'class MultiSetWidget(widgets.DOMWidget):\n' + ' _view_name = Unicode("MultiSetView", sync=True)\n' + ' a = CInt(0, sync=True)\n' + ' b = CInt(0, sync=True)\n' +