tui.grid icon indicating copy to clipboard operation
tui.grid copied to clipboard

bodyHeight: 'fitToParent' property dose not consider parent padding

Open 10sa opened this issue 2 years ago • 5 comments

Summary

  • tui.grid Version : 4.21.3

If parent dom has padding, bodyHeight: 'fitToParent' property dose not consider it.

width is fine.

Reproduce

Steps to reproduce the behavior:

  1. Go to example code page (JSFiddle)
  2. See computed grid container area. (use chrome devtools or something else)

Expected behavior

Grid container height should be fitted with consider padding.

Screenshots

image image

Desktop (please complete the following information):

  • OS: Windows 10 Home 21H2 (Build 19044.1826)
  • Browser : Google Chrome
  • Version : 103.0.5060.134

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser : N/A
  • Version : N/A

Additional context

None.

10sa avatar Jul 28 '22 06:07 10sa

also as known in screenshot, grid container height a little bit greater than parents height. (Parent height : 229.5px, Grid container height : 231px)

i dunno it necessary be fix it. it just a really small value, but maybe effect to other things.

10sa avatar Jul 28 '22 06:07 10sa

in more testing, i figure out property 'fitToParent' is applied container's parent. (not a container. in example codes, #grid dom's parent body)

so, this bug can fix next codes.

Before

<body>
  <div id="grid" style="height: 50vh; padding: 25px">
  </div>
</body>

After

<body>
  <div style="height: 50vh; padding: 25px">
    <div style="height: 100%;">
      <div id="grid">
      </div>
    </div>
  </div>
</body>

i'm not sure it good create new container for container. it already has 3 containers only for this. (#id div, #id div's parent div, tui-grid-container class div)

can be make short with before codes, but currently requires container's container.

10sa avatar Jul 28 '22 07:07 10sa

@10sa

Thanks for report a bug. I'll fix it!

jajugoguma avatar Aug 09 '22 07:08 jajugoguma

@10sa

After checking the problem, in fitToParent, Parent refers to the parent element of the container element passed as an option, not the parent element of the element of the Grid being created.

This is an intentional behavior, and modifying it may cause a breaking change, so we plan to modify it carefully after internal discussion.

thank you!

jajugoguma avatar Aug 10 '22 03:08 jajugoguma

i agree your option. when modify this may (i think almost every case) previous usages are can be breaked.

i know this issue will be discuss internally, but my suggestion is adding new option (like a fitToContainer) for this. it keep prev version compatibility and also resolve this issue.

10sa avatar Aug 10 '22 03:08 10sa