我将 Vaadin 8 用于动态 bean 的表格数据表示。所以我必须在列上定义逻辑过滤器。
为此,我需要来自网格或列对象的列数据类型。 有没有办法获取列的数据类型?
在 Vaadin 7 中,我可以使用 container.getType(columnName)
最佳答案
在Vaadin 8 data binding model ,UI 组件未明确知道属性类型(在您的情况下为 Grid
)。此信息应来自您的领域模型。
如果难以从您的域模型中检索,您可以:
// instead of new Grid(beanType)
PropertySet<YourBeanType> ps = BeanPropertySet.get(beanType);
Grid g = new Grid(ps);
...
// get the property type
// okay, this is ugly, but you get the idea
Class<?> type = ps.getProperty(yourPropertyName).get().getType();
关于vaadin - 如何获取 Vaadin 8 网格列类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45521966/