Skip to content

API calls overlapping items due to maxRow #2953

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

Open
E4RIJMP opened this issue Feb 19, 2025 · 5 comments
Open

API calls overlapping items due to maxRow #2953

E4RIJMP opened this issue Feb 19, 2025 · 5 comments

Comments

@E4RIJMP
Copy link

E4RIJMP commented Feb 19, 2025

Hello,
assuming there is maxRow limit and the grid is stacked with items. The user can still resize one of these items so that other items automatically reposition themselves and move past the row limit to a lower row. But if the same thing is accomplished by using update from the GridStack class, the items will not move to a lower row but overlap each other.

I created a minimal example for this and another issue I encountered (for which I created a separate issue). In that example, clicking the "add items" button will create some items. And clicking "resize item" will make one of these items overlap another one. If this resizing is performed manually (via mouse) everything works as expected and the items will not overlap.

gridstack-angular-example.zip

Regards

@adumesny
Copy link
Member

adumesny commented Feb 20, 2025

please post plain JS example (though I know angular) to make sure it is lib issue and not your code. easier to debug and add to testbed.

@E4RIJMP
Copy link
Author

E4RIJMP commented Feb 21, 2025

Okay, here is some JS. It's not exactly the same, as the previous example had some Angular-specific code (e.g. using "selector" of NgGridStackWidget to use Angular components as items). But here you go:

gridstack-js-example.zip

It uses expressjs and a default port. So, after "npm install" and "node server.js" the code will be running on http://localhost:3000

There are three buttons:

If you click "Resize Init Item 4", "Init Item 4" will overlap "Init Item 5".

If you click "Add 6 more widgets" and then "Resize Added Item 1", "added 1" will push "added 2" down. "added 2" will then overlap "added 4".

In both scenarios the behavior is different from what happens, if you manually resize "Resize Init Item 4" or "added 1" via mouse.

@adumesny
Copy link
Member

adumesny commented Feb 24, 2025

I was going to say the bug report say to use online bug example, but looks the template got deleted... what's next. hummm. Used to say:

Steps to reproduce

You MUST provide a working demo - keep it simple and avoid frameworks as that could have issues - you can use
https://jsfiddle.net/adumesny/jqhkry7g

@E4RIJMP
Copy link
Author

E4RIJMP commented Feb 24, 2025

The third time is the charm I guess.

Steps to reproduce

  • Create a grid where "maxRow" is set
  • Fill the grid with enough items to reach the row limit
  • Resize one of these items via "grid.update(...)"

https://jsfiddle.net/ar4ycvuj/

@adumesny
Copy link
Member

adumesny commented Feb 24, 2025

Oh see, you are filling maxRow and asking to resize in code things that it can't fit (interactively it will NOT do it if it can't). That is a corner case that wasn't tested for sure... thanks for the demo.

@adumesny adumesny changed the title Overlapping items due to maxRow API calls overlapping items due to maxRow Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants