@@ -720,8 +720,7 @@ export class GridStack {
720720 * @see {@link http://gridstackjs.com/demo/serialization.html } for complete example
721721 */
722722 public load ( items : GridStackWidget [ ] , addRemove : boolean | AddRemoveFcn = GridStack . addRemoveCB || true ) : GridStack {
723- items = Utils . cloneDeep ( items ) ; // so we can mod
724- const column = this . getColumn ( ) ;
723+ // items = Utils.cloneDeep(items); // TODO: let callee decide by using directly instead of copy we can modify ?
725724
726725 // make sure size 1x1 (default) is present as it may need to override current sizes
727726 items . forEach ( n => { n . w = n . w || n . minW || 1 ; n . h = n . h || n . minH || 1 } ) ;
@@ -736,6 +735,7 @@ export class GridStack {
736735 let maxColumn = 0 ;
737736 items . forEach ( n => { maxColumn = Math . max ( maxColumn , ( n . x || 0 ) + n . w ) } ) ;
738737 if ( maxColumn > this . engine . defaultColumn ) this . engine . defaultColumn = maxColumn ;
738+ const column = this . getColumn ( ) ;
739739 if ( maxColumn > column ) {
740740 // if we're loading (from empty) into a smaller column, check for special responsive layout
741741 if ( this . engine . nodes . length === 0 && this . responseLayout ) {
@@ -1494,9 +1494,11 @@ export class GridStack {
14941494 if ( o . class !== undefined && o . class !== opts . class ) { if ( opts . class ) this . el . classList . remove ( opts . class ) ; if ( o . class ) this . el . classList . add ( o . class ) ; }
14951495 // responsive column take over actual count (keep what we have now)
14961496 if ( o . columnOpts ) {
1497+ const hadColumnOpts = ! ! this . opts . columnOpts ;
14971498 this . opts . columnOpts = o . columnOpts ;
1499+ if ( hadColumnOpts !== ! ! this . opts . columnOpts ) this . _updateResizeEvent ( ) ;
14981500 this . checkDynamicColumn ( ) ;
1499- } else if ( o . columnOpts === null && this . opts . columnOpts ) {
1501+ } else if ( o . columnOpts === null && this . opts . columnOpts ) { // delete update cmd
15001502 delete this . opts . columnOpts ;
15011503 this . _updateResizeEvent ( ) ;
15021504 } else if ( typeof ( o . column ) === 'number' ) this . column ( o . column ) ;
@@ -1510,7 +1512,7 @@ export class GridStack {
15101512 this . _updateContainerHeight ( ) ;
15111513 } else {
15121514 if ( o . minRow !== undefined ) { opts . minRow = o . minRow ; this . _updateContainerHeight ( ) ; }
1513- if ( o . maxRow !== undefined ) opts . maxRow = o . maxRow ;
1515+ if ( o . maxRow !== undefined ) opts . maxRow = this . engine . maxRow = o . maxRow ;
15141516 }
15151517 if ( o . lazyLoad !== undefined ) opts . lazyLoad = o . lazyLoad ;
15161518 if ( o . children ?. length ) this . load ( o . children ) ;
0 commit comments