New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: nested grids #1980
fix: nested grids #1980
Conversation
src/gridstack-dd.ts
Outdated
const item:GridStackWidget = { | ||
...node._orig, | ||
content: node.content, | ||
subGrid: subgrid.save(true, true) as GridStackOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this workaround, but serializing out and reading back to just update a few styles is very heavy handed. Eg: large content or dynamic items in that subgrid. I will pull your changes locally and tweaks...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reply. If you need any help, then I am ready to participate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also found your changes didn't work for the example (nested.html) that I tried, and css styling will be changing dramatically with the other pending pull request, so I will rebase your changes and modify after the other changes are in instead...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is not always data in node._orig
, so I replaced it with this._readAttr(this.placeholder)
. But now there is another problem with styles, that is, there is no way to drag to those positions in which there was already a subgrid. That's probably what you mean. I will be waiting for a solution from you, thank you
screencast-nimbus-capture-2022.06.16-10_06_20.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fix this behaviour. Сan you tell me when you can try to make a more productive solution? I would be very grateful if this task is solved in the first place :)
this.engine.addedNodes.push(node);// @ts-ignore | ||
this._triggerAddEvent();// @ts-ignore | ||
|
||
const subgrid = node.subGrid as GridStack; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that looks a lot better. Just add this comment
// if dropping a subgrid, make sure to update its style #1943
@@ -12,6 +12,8 @@ | |||
/* make nested grids have slightly darker bg */ | |||
.grid-stack.grid-stack-nested { | |||
background: #e4e4c1; | |||
border: 2px dashed rgba(0, 0, 0, 0.4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are those CSS changes necessary ? I though the blended background was enough to distinguish the nesting - adding border will mess the padding and create unnecessary scroll content/sizing issues...
I didn't pull in your changes to check.
thanks for suggesting the fix - turns out it was a bit more complicated as style in the head don't need this fix,a nd you need to check if actual sub-grid and not options... Anyway, fixed as part of #2052 |
Description
Fix #1943