Subject of the issue
Widget width is incorrect in JSON produced by the save() method, if the given widget has been dragged from a nested grid that has more columns than the outer grid. The grid and widgets behave correctly, the problem is only with data generated by save(). Loading back this data into the grid will cause an incorrect state (since the JSON contains an impossible layout)
The save() method in gridstack-engine.ts takes the width value from this._layouts if present. The resized node's actual width seems correct, the incorrect value seems to come from this._layouts
https://github.com/gridstack/gridstack.js/blob/89ae9d6fd163137c5fde895ae14d1c5d2bb7a495/src/gridstack-engine.ts#L746C7-L746C7

Your environment
- version of gridstack.js - 8.2.3
- which browser/OS - Firefox 116 / Chrome 114, Windows
Steps to reproduce
- Drag a widget from a grid with 2 columns into a nested grid with 3 columns
- Resize the widget to be as wide as possible
- Drag the widget back into the main grid from the nested grid
- Resize the widget
The widget will have its width reported incorrectly in the JSON data generated by save()
https://jsfiddle.net/akosfekete/Lpv2au4w/11/

Expected behavior
The width should be the same as it appears in the layout.
Subject of the issue
Widget width is incorrect in JSON produced by the
save()method, if the given widget has been dragged from a nested grid that has more columns than the outer grid. The grid and widgets behave correctly, the problem is only with data generated bysave(). Loading back this data into the grid will cause an incorrect state (since the JSON contains an impossible layout)The

save()method ingridstack-engine.tstakes the width value fromthis._layoutsif present. The resized node's actual width seems correct, the incorrect value seems to come fromthis._layoutshttps://github.com/gridstack/gridstack.js/blob/89ae9d6fd163137c5fde895ae14d1c5d2bb7a495/src/gridstack-engine.ts#L746C7-L746C7
Your environment
Steps to reproduce
The widget will have its width reported incorrectly in the JSON data generated by
save()https://jsfiddle.net/akosfekete/Lpv2au4w/11/

Expected behavior
The width should be the same as it appears in the layout.