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

[Bug] After load(), in some cases the Y position is determined incorrectly & sizes are not restored. #2669

Open
IgorA100 opened this issue Apr 24, 2024 · 8 comments
Labels

Comments

@IgorA100
Copy link

Subject of the issue

I save current layout and then load it. In some cases, elements are assigned the value gs-y="0" instead of the stored gs-y="3"
This is also confirmed at https://gridstackjs.com/demo/serialization.html

Your environment

  • version of gridstack.js - 10.1.2
  • which browser/OS - Windows 8.1. Chrome 109.0.5414.168

Steps to reproduce

bandicam.2024-04-24.15-31-43-405.mp4

Expected behavior

After load() element's Y position should always match the stored gs-y="3", not gs-y="0"

@IgorA100
Copy link
Author

There is also a problem with the sizes of elements when Load()

bandicam.2024-04-24.16-12-42-666.mp4

@IgorA100 IgorA100 changed the title After load(), in some cases the Y position is determined incorrectly [Bug] After load(), in some cases the Y position is determined incorrectly & sizes are not restored. Apr 24, 2024
@adumesny
Copy link
Member

the bug culd be in the demo itself (fail to load the saved data) or the lib, but a bug reguardless...

@IgorA100
Copy link
Author

IgorA100 commented Apr 24, 2024

No, this is not an error reading saved data. This shows up in my development environment as well.
Initially I looked for the problem in my development environment, and only then I started checking on the demo page.
What lib are you talking about?

As far as I understand, the error depends on the arrangement of the elements. Yes, it does not always appear. But try for yourself to perform the actions that I filmed on video and you will be convinced of the mistake!

@erdoganfurkann
Copy link

I'm having a similar problem too. When I set float: true, this problem disappears, but I do not want to use the float feature.

@adumesny
Copy link
Member

adumesny commented Apr 30, 2024

@erdoganfurkann that is a good hint! likely repacking after each item instead of after all info are read in.

@erdoganfurkann
Copy link

I have a temporary solution that worked for me. I always initialize the grid stack with float: true option, then change float to false using gridstack's float() method. I call float(false) in the dragstart and resizestart event handlers, but I guess this can also be called in a callback function that runs after the DOM is loaded.

@adumesny
Copy link
Member

if someone wants to donate I could take a look but I'm really busy these days, else make a fix. thanks.

@brian-patrick-3
Copy link

I'm seeing cases where .save() is missing values like h for individual widgets, which causes the entire page to freeze when you try to call .load()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants