Skip to content

different order when reloading in oneColumnMode and normal mode #1816

Closed

Description

@emrgdc

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.

Activity

  1. adumesny commented on Sep 13, 2021

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

  2. scotcomms-saunderss commented on Sep 13, 2021

    @scotcomms-saunderss

    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.

  3. adumesny commented on Sep 13, 2021

    @adumesny
    Member

    same issue as #1849

  4. adumesny commented on Oct 16, 2021

    @adumesny
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions