我正在使用vaadin的TreeTable。有没有办法删除或隐藏没有任何子项的第一级对象上的下拉箭头,并且仍然可以正确地垂直放置对象?
更新
最终解决方案,如果有人有兴趣:
我在表中添加了FieldFactory
protected class TableFactory extends DefaultFieldFactory{
private static final long serialVersionUID = 1L;
private MyTreeTable table;
public TableFactory(MyTreeTable table){
this.table = table;
}
@Override
public Field createField(Container container, Object itemId,
Object propertyId, Component uiContext) {
Field field = super.createField(container, itemId, propertyId, uiContext);
if(itemId instanceof TaskHeadRow){
if(((TaskHeadRow)itemId).getTask() instanceof SystemTask){
table.setChildrenAllowed(itemId, false);
}
}
return field;
}
}
答案 0 :(得分:3)
如果您为项目定义,则不显示箭头:
treetable.setChildrenAllowed("myitemid", false);