How can I see details to grid in Vaadin flow?

穿精又带淫゛_ 提交于 2020-01-06 08:00:29

问题


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

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?


回答1:


There are two options to do that:

  • 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: 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");


来源:https://stackoverflow.com/questions/54987458/how-can-i-see-details-to-grid-in-vaadin-flow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!