如何在Vaadin流中查看网格的详细信息

如何在Vaadin流中查看网格的详细信息

本文介绍了如何在Vaadin流中查看网格的详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Vaadin流项目中,我有一个网格并设置了一些项目,但它显示为网格数据项

In my Vaadin flow project, I have a grid and I set some items but it shows like grid data items

我希望用户能看到不喜欢的特定详细信息的格式. vaadin有什么想法或要让它变得漂亮吗?

I want a decent format that a user can see specific details not like. Any idea or is there any component in vaadin to make this pretty?

推荐答案

有两种方法可以做到这一点:

There are two options to do that:

    与现在在您的媒体资源中使用的.toString()相比,
  • 提供了更好的ValueProvider.例如
  • provide a better ValueProvider than the .toString(), that is used in your property right now. E.g.
grid.addColumn(person -> Integer.toString(person.getYearOfBirth()))
        .setHeader("Year of birth");

  • TemplateRenderer:您可以提供一个用于放置内容的复杂" HTML结构.该文档包含一个示例: https://github.com/vaadin/flow-and-components-documentation/blob/master/documentation/components/tutorial-flow-grid.asciidoc#using-template-renderers 例如:
    • TemplateRenderer: You can provide a "complex" HTML structure where to place content. The docs contain an example: https://github.com/vaadin/flow-and-components-documentation/blob/master/documentation/components/tutorial-flow-grid.asciidoc#using-template-renderers E.g.:
    • grid.addColumn(TemplateRenderer.<Person> of("<b>[[item.name]]</b>")
                    .withProperty("name", Person::getName)).setHeader("Name");
      

      这篇关于如何在Vaadin流中查看网格的详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 20:55