@@ -68,7 +68,7 @@ let SheetModel = widgets.DOMWidgetModel.extend({
68
68
initialize : function ( ) {
69
69
SheetModel . __super__ . initialize . apply ( this , arguments ) ;
70
70
this . data = [ [ ] ] ;
71
- this . update_data_grid ( ) ;
71
+ this . update_data_grid ( false ) ;
72
72
this . _updating_grid = false ;
73
73
this . on ( 'change:rows change:columns' , this . update_data_grid , this ) ;
74
74
this . on ( 'change:cells' , this . on_change_cells , this ) ;
@@ -100,6 +100,9 @@ let SheetModel = widgets.DOMWidgetModel.extend({
100
100
} ) ;
101
101
} ,
102
102
cells_to_grid : function ( ) {
103
+ this . data = [ [ ] ] ;
104
+ this . update_data_grid ( false ) ;
105
+
103
106
each ( this . get ( 'cells' ) , ( cell ) => {
104
107
this . _cell_data_to_grid ( cell )
105
108
} ) ;
@@ -195,7 +198,7 @@ let SheetModel = widgets.DOMWidgetModel.extend({
195
198
this . _updating_grid = false ;
196
199
}
197
200
} ,
198
- update_data_grid : function ( ) {
201
+ update_data_grid : function ( trigger_change_event = true ) {
199
202
// create a row x column array of arrays filled with null
200
203
let rows = this . get ( 'rows' ) ;
201
204
let columns = this . get ( 'columns' ) ;
@@ -224,7 +227,9 @@ let SheetModel = widgets.DOMWidgetModel.extend({
224
227
}
225
228
this . data [ i ] = row ;
226
229
}
227
- this . trigger ( 'data_change' ) ;
230
+ if ( trigger_change_event ) {
231
+ this . trigger ( 'data_change' ) ;
232
+ }
228
233
}
229
234
} , {
230
235
serializers : extend ( {
0 commit comments