Vaadin 23在Grid标题中对齐组件以进行过滤

huangapple go评论48阅读模式
英文:

Vaadin 23 align components in Grid header for filtering

问题

这是我用于Grid筛选组件的代码:

headerRow.getCell(idColumn).setComponent(FilterUtils.createIdFilterHeader(dataViewFilter::setId, "user.id"));
headerRow.getCell(nameColumn).setComponent(FilterUtils.createNameFilterHeader(dataViewFilter::setName, "user.first.name"));

VerticalLayout referrerFilterVerticalLayout = new VerticalLayout();
referrerFilterVerticalLayout.setMargin(false);
referrerFilterVerticalLayout.setPadding(false);
referrerFilterVerticalLayout.setSpacing(false);

referrerFilterVerticalLayout.add(FilterUtils.createIdFilterHeader(dataViewFilter::setReferrerId, "referrer.id"));
referrerFilterVerticalLayout.add(FilterUtils.createNameFilterHeader(dataViewFilter::setReferrerName, "referrer.first.name"));

headerRow.getCell(referredByColumn).setComponent(referrerFilterVerticalLayout);

现在的表头如下所示:

Vaadin 23在Grid标题中对齐组件以进行过滤

我需要调整前两个组件的位置,使它们上移以获得如下所示的效果:

Vaadin 23在Grid标题中对齐组件以进行过滤

请展示如何实现这个效果。

英文:

This is the code I have for Grid filtering components:

headerRow.getCell(idColumn).setComponent(FilterUtils.createIdFilterHeader(dataViewFilter::setId, "user.id"));
headerRow.getCell(nameColumn).setComponent(FilterUtils.createNameFilterHeader(dataViewFilter::setName, "user.first.name"));

VerticalLayout referrerFilterVerticalLayout = new VerticalLayout();
referrerFilterVerticalLayout.setMargin(false);
referrerFilterVerticalLayout.setPadding(false);
referrerFilterVerticalLayout.setSpacing(false);

referrerFilterVerticalLayout.add(FilterUtils.createIdFilterHeader(dataViewFilter::setReferrerId, "referrer.id"));
referrerFilterVerticalLayout.add(FilterUtils.createNameFilterHeader(dataViewFilter::setReferrerName, "referrer.first.name"));

headerRow.getCell(referredByColumn).setComponent(referrerFilterVerticalLayout);

Right now the header looks like:

Vaadin 23在Grid标题中对齐组件以进行过滤

I need to adjust the first two components and move them up to get something like this:

Vaadin 23在Grid标题中对齐组件以进行过滤

Please show how to achieve this.

答案1

得分: 0

可能最简单的方法是将您的筛选框放在两个水平布局中,放在垂直布局内。

英文:

Probably the easiest thing would be to stick your filter boxes in two Horizontal Layouts, within the Vertical Layout.

huangapple
  • 本文由 发表于 2023年2月16日 19:12:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75471427.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定