Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Vaadin Flow中显示网格单元工具提示_Vaadin_Vaadin Grid - Fatal编程技术网

如何在Vaadin Flow中显示网格单元工具提示

如何在Vaadin Flow中显示网格单元工具提示,vaadin,vaadin-grid,Vaadin,Vaadin Grid,使用Vaadin 8,可以为网格单元设置工具提示。此功能在Vaadin Flow中不可用(目前使用的是v 11.0.0)。有其他选择吗?目前还没有内置功能。最简单的方法可能是设置元素的“title”属性。一个例子是使用TemplateRenderer,这里有一个例子 从上面的示例复制代码的相关部分 grid.addColumn(TemplateRenderer.<Person> of( "<div title='[[item.name]]'>[[item

使用Vaadin 8,可以为网格单元设置工具提示。此功能在Vaadin Flow中不可用(目前使用的是v 11.0.0)。有其他选择吗?

目前还没有内置功能。最简单的方法可能是设置元素的“title”属性。一个例子是使用TemplateRenderer,这里有一个例子

从上面的示例复制代码的相关部分

grid.addColumn(TemplateRenderer.<Person> of(
        "<div title='[[item.name]]'>[[item.name]]<br><small>[[item.yearsOld]]</small></div>")
        .withProperty("name", Person::getName).withProperty("yearsOld",
                person -> person.getAge() > 1
                        ? person.getAge() + " years old"
                        : person.getAge() + " year old"))
        .setHeader("Person");
grid.addColumn(templaterender.of(
“[[item.name]]
[[item.yearsell]]”) .withProperty(“名称”,Person::getName).withProperty(“YearSelled”, person->person.getAge()>1 ?person.getAge()+“岁” :person.getAge()+“岁”)) .setHeader(“人”);