tui.grid
tui.grid copied to clipboard
bodyHeight: 'fitToParent' property dose not consider parent padding
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:
- Go to example code page (JSFiddle)
- See computed grid container area. (use chrome devtools or something else)
Expected behavior
Grid container height should be fitted with consider padding.
Screenshots
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.
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.
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
Thanks for report a bug. I'll fix it!
@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!
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.