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

different order when reloading in oneColumnMode and normal mode #1816

Closed
emrgdc opened this issue Jul 15, 2021 · 4 comments
Closed

different order when reloading in oneColumnMode and normal mode #1816

emrgdc opened this issue Jul 15, 2021 · 4 comments
Labels

Comments

@emrgdc
Copy link

emrgdc commented Jul 15, 2021

Subject of the issue

If you add widgets with the addWidget function of gridStack while in normal column mode and then resize the window so it moves to oneColumnMode the widgets are displayed in the correct order but if you do a reload whilst in oneColumnMode the widgets will reload in a different order and when resizing it back to normal column mode display other than reloading it in normal mode.

Steps to reproduce

I have edited your jsFiddle a bit.
The link to reproduce the issue is:
https://jsfiddle.net/zcvu9osh/2/

Expected behavior

There should be no difference in the order when reloading in normal column mode and oneColumnMode.

@adumesny
Copy link
Member

there is no real way for me to know when adding 1 widget at a time into 1 column that you mean this was 12 column (or any other) layout - just because the x,y or w,h are bigger than [0,1] ? is that enough of a hint... maybe, since 1 column mode is so 'transient'. humm...

@scotcomms-saunderss
Copy link

In my particular use-case, I've created a dashboard in 12-column layout and then used the Save Grid function. The serialised representation of the dashboard has the items in the correct row/column ordering. On resizing the page the oneColumnMode is consistent with the ordering in the serialised representation.

If the page is refreshed while sized for full 12-column layout mode, then the serialised items are loaded and the dashboard initialised correctly with oneColumnMode still showing the correct ordering if you then shrink the page.

However, if you size the page small enough for a oneColumnMode dashboard, then refresh the page to reload the dashboard items with oneColumnMode active ... the same set of serialised items are loaded, but the ordering isn't consistent with the ordering in the serialised items array. At least not in my case. It looks like it's using some logic other than using the defined array element index ordering, nor scanning for row/column in the gsY/gsX values.? That means that when sizing the page back up to 12-column mode the elements appear all over the place, despite them having been added with their correct position and width / height parameters (almost as if the x/y positions are discarded).

Haven't had time to dig into the code yet to confirm, so I could be wildly wrong here.

@adumesny
Copy link
Member

same issue as #1849

adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 16, 2021
fix gridstack#1849 gridstack#1816
* always save the layout with the highest resolution no matter what current column count is (eg: 12 when in 1 column mode)
to make sure we keep full resolution on restore.
adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 16, 2021
fix gridstack#1849 gridstack#1816
* always save the layout with the highest resolution no matter what
current column count is (eg: 12 when in 1 column mode)
to make sure we keep full resolution on restore.
@adumesny
Copy link
Member

fixed in next release. don't forget to donate if you find this lib useful!

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

3 participants