Reputation: 43
I use this grid stack code for my main code. https://gridstackjs.com/demo/nested.html I additionally add the button and call the addnestedgrid function on that button.
Below is the code for the function addnestedgrid
function addnestedGrid(){
grid.addWidget({x:1, y:1, h:3, subGridOpts: {children: [], ...subOptions}});
}
Below is the image of updated HTML
I face the issue when the last nested grid item drags and adds the new grid. The issue is that the x and y values differ from what I expected.
You can find the whole code of the updated grid HTML in below GitHub repo Github:- https://github.com/darshanmulani005/Grid
Website:- https://darshanmulani005.github.io/Grid/
Issue:- Add the nested grid from the addnestedgrid button and add 2-3 widgets from the add widget button. After that add the main grid widget to the nested grid that adds from the button and then click the save button. In the console, you find the one object with the data. You have to open the subgrid object. In our case it's second. You can see that children's x and y values are not what we expect.
Upvotes: 2
Views: 114