请问Table上有类似DataGrid的setRowDescriptionProvider() 方法吗?

请问Table上有类似DataGrid的setRowDescriptionProvider() 方法吗?

参考这个帖子:

1 个赞

尝试使用他提供解决方法:

customerTable.unwrap(com.vaadin.ui.Table.class)
.setItemDescriptionGenerator((source, itemId, propertyId) -> {
if (propertyId == null) {
return “Row description”;
} else if (propertyId == NAME_COLUMN_PROPERTY_ID) {
return “Cell description”;
}
return null;
});

时,发现没有com.vaadin.ui.Table.class这个类,我现在使用的是7.1,请问正确的类名是什么呀?

我改成这样写了,但是毫无效果,这还需要设置什么吗?
adapterParamDefinitionsTable.unwrap(com.vaadin.v7.ui.Table .class)
.setItemDescriptionGenerator((source, itemId, propertyId) -> {
if (propertyId == null) {
return “Row description”;
}
return null;
});

还能抢救一下吗?

上面那个方法就对的,只是刚好条件不满足返回了NULL,修改一下代码不要返回null试试

image

不是说通过这个判断来实现行的提示吗?

方法中返回的内容就是提示信息。如果返回null,就没有提示。

找到原因了,我是写在onInit中,没有效果,放到onBeforeShow就好了

onInit 中也是可以的。

image