-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
"grid.save()" returns wrong grid representation (nested and changed column count) #2493
Comments
looks like #2394 but that was addressed, so maybe not the correct fix then... |
Quick update: the problem is still present in version Another, potentially related issue (that might help in diagnosing the cause of this issue?) can be seen in the following fiddle: https://jsfiddle.net/4Lpum5f2/ The left grid has two columns, the right three. If an item spanning three columns is dragged to the grid spanning two columns, its Finally, for everyone coming across this problem, there is the following workaround: as the This callback is not documented here, however ...: ... but it can be seen in the source code: Line 597 in 599965a
|
my guess has to do with having higher column count for nested grid using that instead of the current column count displayed. |
Solution proposed by @adiessl did the trick for me! |
That seems to be the case, as for me the wrong width gets saved after I've resized the window. It seems to be caused by using the cached value in The following
|
| caused by using the cached value in this._layouts of GridStackEngine, that doesn't get cleared when resizing the widget manually
|
But if I have opened my dashboard in a smaller size for any reason, shouldn't i be able to for example make a widget be only one column wide? |
edits in one size will try to propagate to the other larger sizes (with possible scale factor between column count). but it's not an exact science. short of saving for all ever displayed layouts you're not going to have a perfect solution, and even that might not what you want (should editing in 6 column also change 12 column or leave unchanged since technically you can now edit and save 12 column separatedly). |
I also had this issue and this helped. |
Subject of the issue
When using
grid.save()
after particular changes, the grid representation that gets returned is incorrect.Your environment
9.3.0
Steps to reproduce
https://jsfiddle.net/vs81frby/
This Fiddle contains two grids, each one having two columns. The grids use the same options:
The grid on the right contains two items initially, labeled
A
andB
.B
is dragged to the left grid to positionx: 1, y: 2
. ItemA
is then resized to span the whole width of the right grid, thus havingw: 2
. It is then also moved to the left grid to positionx: 0, y: 4
.grid.save()
returnsx: 1, y: 2
in this case, however (the width returned is still correct:w: 2
).A
is then resized to be one column wide again –grid.save()
incorrectly returnsw: 6
now. MovingA
to the top left position in the left grid should seegrid.save()
returningx: 0, y: 0
, but it returnsx: 1, y: -2
.The following GIF shows this behavior as well:
Expected behavior
x
,y
,w
andh
should reflect the real values.This might only be a bug in the
grid.save()
method, as the attributesgs-x
,gs-y
andgs-w
on the actual DOM nodes do have the correct values.The text was updated successfully, but these errors were encountered: