Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(resize): update the grid to resize when initialised in the smaller screen #2949

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ export class GridStack {
opts = Utils.defaults(opts, defaults);
this._initMargin(); // part of settings defaults...

// Now check if we're loading into 1 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)
this.checkDynamicColumn();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this removes optimizations so this isn't the right fix even if it fixes the issue...

this.el.classList.add('gs-' + opts.column);

if (opts.rtl === 'auto') {
Expand Down Expand Up @@ -440,6 +438,9 @@ export class GridStack {
this._setupRemoveDrop();
this._setupAcceptWidget();
this._updateResizeEvent();

// To ensure that the grid is resized to the current screen width when the grid is initialized
this.onResize()
}

/**
Expand Down