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

cellHeight(val) does not work properly on v0.5.3 (but OK on v0.5.2) #1068

Closed
LouisSung opened this issue Nov 24, 2019 · 2 comments
Closed

cellHeight(val) does not work properly on v0.5.3 (but OK on v0.5.2) #1068

LouisSung opened this issue Nov 24, 2019 · 2 comments
Labels

Comments

@LouisSung
Copy link

LouisSung commented Nov 24, 2019

Subject of the issue

Seems like function cellHeight(val) doesn't work properly on v0.5.3.

E.g.,

  1. not able to auto resize height while resizing (Browser) Window, and
  2. (re)assign height by calling this function (although the one in constructor $('.grid-stack').gridstack can set up height correctly)

However, it works fine after I downgrade to v0.5.2.
There should be something wrong for this version, but not sure if anyone has already find out the issue and prepare to fix it

Environment

  • Failed on v0.5.3
  • Success on v0.5.2

Steps to reproduce

I think it's easy to reproduce(?
Sorry for not familiar with jsfiddle. QQ

Simple example

  1. Save following code as local .html file and open it with browser
  2. Uncomment #L17 to see the difference
  3. #L21 also shows the cellHeight(val) after init (constructor)
<html><head><link href="https://cdn.jsdelivr.net/npm/gridstack@v0.5.2/dist/gridstack.min.css" rel="stylesheet"></head><body>

<div class="grid-stack">
  <div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="2" data-gs-height="2" style="background-color:red">
    <div class="grid-stack-item-content">11111</div></div>
  <div class="grid-stack-item alert-success" data-gs-x="2" data-gs-y="0" data-gs-width="2" data-gs-height="2" style="background-color:green">
    <div class="grid-stack-item-content _align_center">22222</div></div>
  <div class="grid-stack-item" data-gs-x="4" data-gs-y="0" data-gs-width="2" data-gs-height="2" style="background-color:blue">
    <div class="grid-stack-item-content">33333</div></div>
</div>

<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gridstack@v0.5.2/dist/gridstack.all.js"></script>

<!-- uncomment next line to compare function `cellHeight(val)` between v0.5.2 and v0.5.3 -->
<!-- <script src="https://cdn.jsdelivr.net/npm/gridstack@v0.5.3/dist/gridstack.all.js"></script> -->

<script>$(function(){
  $('.grid-stack').gridstack({disableOneColumnMode:true,verticalMargin:0,cellHeight:'auto'});
  $('.grid-stack').data('gridstack').cellHeight(20);    // change height after initialization
});</script>

</body></html>
@adumesny
Copy link
Member

adumesny commented Nov 25, 2019

thank for for the sample, I will take a look.

Update: This was caused by change #1047 (fix for #937) and will check with @radiolips

@adumesny
Copy link
Member

fixed in next release 0.5.4

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

2 participants