Skip to content
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

Closed
wants to merge 6 commits into from
Closed

fix: nested grids #1980

wants to merge 6 commits into from

Conversation

v1talii-dev
Copy link
Contributor

Description

Fix #1943

src/gridstack-dd.ts Outdated Show resolved Hide resolved
const item:GridStackWidget = {
...node._orig,
content: node.content,
subGrid: subgrid.save(true, true) as GridStackOptions
Copy link
Member

@adumesny adumesny Jun 15, 2022

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...

Copy link
Contributor Author

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.

Copy link
Member

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...

Copy link
Contributor Author

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

Copy link
Contributor Author

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;
Copy link
Member

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);
Copy link
Member

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.

@adumesny
Copy link
Member

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

@adumesny adumesny closed this Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support nest grid more than 2 level
2 participants