Vaadin 自定义表头

发布于 2024-10-04 03:55:03 字数 97 浏览 0 评论 0原文

我想为 Vaadin 表构建自定义过滤标头。

您能举一些例子或解决这个问题吗?

我想添加一个组合框或复选框,以像 Excel 列一样细化表中的搜索。

I want to build custom filtering header for Vaadin tables.

Can you please give some examples or solution to this problem.

I want to add a combo box or check box that will refine the search in the table like Excel columns.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

屌丝范 2024-10-11 03:55:03

我们也面临着在项目中为 Vaadin 表添加自定义过滤器的问题。

作为解决方案,我们在表格上方添加了动态过滤器表单。它已经变得足够灵活和敏捷,可以应用过滤器。

我们创建 Vaadin Addon 是为了分享我们的解决方案 - Lexaden Grid。

您可以通过以下链接找到更多信息:

http://www.lexaden.com/main/entry /lexaden_grid

We faced the problem of adding custom filters for Vaadin Table in our project as well.

As a solution we added a dynamic filter form above the table. It has become flexible and agile enough to apply filters.

We created Vaadin Addon in order to share our solution - Lexaden Grid.

You can find more information by the following link:

http://www.lexaden.com/main/entry/lexaden_grid

离笑几人歌 2024-10-11 03:55:03

目前,添加自定义组件来对表头进行过滤非常困难。它将要求您通过继承/复制和粘贴来制作自己的 Table 版本(不确定什么是足够的),如果可能的话,这是大多数人目前不想避免的事情。 Table 组件当前的实现是 Vaadin 最复杂的组件之一。如果您坚持将组件放在标头中,这是可行的,但要准备好进行一些认真的思考以使事情正常进行。

我建议在表格旁边/上方的组件中对容器中的数据进行过滤。如果表头没有显示重要信息,则隐藏表头有时是可以接受的。如果你想要在标题上精确显示某些内容,则需要一些空标题和 CSS 定位组件在正确的位置。

您始终可以将表和其他过滤组件分组到一个 CustomComponent 中,以便于抽象。

At the moment it is quite hard to add a custom component to do filtering with to the header of a table. It would require you to make your own version of Table by inheritance/copy&paste (not sure what is enough), and that is something most people wan't to avoid at the moment if anyway possible. The current implementation of the Table component is one of the most complicated components of Vaadin. It is doable if you insist putting components in header, but prepare for some serious thinking to get things to work.

I'd suggest making the filtering of data in containers with components just next/above your table. Hiding the table header is sometimes acceptable if there's no crucial information shown there. If you want something precisely on the header, it would require some empty headers and CSS positioning components on correct place.

You can always group table and other filtering components to one CustomComponent for easier abstraction.

请帮我爱他 2024-10-11 03:55:03

Book of Vaadin 是一个非常好的 vaadin 实现参考。该链接包含一个示例代码,例如:

// Define the properties
table.addContainerProperty("lastname", String.class, null);
table.addContainerProperty("born", Integer.class, null);
table.addContainerProperty("died", Integer.class, null);
// Set nicer header names
table.setColumnHeader("lastname", "Name");
table.setColumnHeader("born", "Born");
table.setColumnHeader("died", "Died");

这是您所要求的吗?如果不是,您能更清楚地说明您的问题吗?

编辑: Vaadin Sampler 还包含一些代码示例。

Book of Vaadin is a very good reference for vaadin implementation. The link consist of an example code like:

// Define the properties
table.addContainerProperty("lastname", String.class, null);
table.addContainerProperty("born", Integer.class, null);
table.addContainerProperty("died", Integer.class, null);
// Set nicer header names
table.setColumnHeader("lastname", "Name");
table.setColumnHeader("born", "Born");
table.setColumnHeader("died", "Died");

Is this what you ask for? If it isn't, can you please specify your question a bit more clearly?

edit: Vaadin Sampler also contains handful code samples.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文