jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
561 stars 121 forks source link

Incorrect alignment in generated columns for TreeDataGrid when using HBoxLayout #3416

Closed KremnevDmitry closed 2 months ago

KremnevDmitry commented 3 months ago

Environment

Jmix version: 1.6.999-SNAPSHOT

Bug Description

When displaying treeDataGrid in generated columns containing HBoxLayout, some elements are shifted to the side.

Current Behavior

image

Expected Behavior

image

Sample Project

tdg_test.zip

glebfox commented 2 months ago

It appears to be a client side error related to issues to calculate correct padding and margin in case of expanding a component inside a layout.

The correct layout look as follows:

Screenshot 2024-07-05 at 13 29 00

Padding 48px: 36px for button and 12px for spacing

Incorrect layout:

Screenshot 2024-07-05 at 13 29 30

Padding 12px: only for spacing. For some reason a button isn't included into calculation.

The problem can be avoided on project side, by implementing a different layout based on CSS Flex, so no calculating of padding and margin are needed to expand a components inside.

CssLayout layout = uiComponents.create(CssLayout.class);
layout.setWidthFull();
htmlAttributes.applyCss(layout, "display:flex; gap:12px");

To expand TextField inside Flex container, just set width=100% for it.