private void myTreePage() {
private final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("<root>");
DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
statusImport();
ITreeProvider<DefaultMutableTreeNode> modelProvider = new TreeModelProvider<DefaultMutableTreeNode>(treeModel, false) {
private static final long serialVersionUID = 1L;
@Override
public IModel<DefaultMutableTreeNode> model(DefaultMutableTreeNode object) {
return Model.of(object);
}
};
TableTree<DefaultMutableTreeNode, String> myTestTree = new TableTree<DefaultMutableTreeNode, String>("myTestTreeTable", createColumns(), modelProvider, Long.MAX_VALUE) {
private static final long serialVersionUID = 1L;
@Override
protected Component newContentComponent(String id, IModel<DefaultMutableTreeNode> model) {
//return new CheckedFolder<DefaultMutableTreeNode>(id, this, model);
return new Folder<DefaultMutableTreeNode>(id, this, model);
}
};
myTestTree.setOutputMarkupId(true);
myTestTree.add(new WindowsTheme());
myTestTree.getTable().add(AttributeModifier.replace("style", "width: 100%; background-color:white;"));
addOrReplace(myTestTree);
}
private List<? extends IColumn<DefaultMutableTreeNode, String>> createColumns() {
columns.add(new TreeColumn<>(new Model("Tree"), "obj.text"));
columns.add(new PropertyColumn<>(new Model("FileStatus"), "FileStatus", "obj.fileStatus"));
columns.add(new PropertyColumn<>(new Model("StartDate"), "StartDate", "obj.startDate"));
columns.add(new PropertyColumn<>(new Model("LastDate"), "LastDate", "obj.lastDate"));
columns.add(new PropertyColumn<>(new Model("Count"), "Count", "obj.count"));
return columns;
}
在树表视图中,列标题不显示“tree”、“filestatus”、“startdate”、“lastdate”、“count”。
有人能帮助我们如何在树表中显示树表列的标题吗?这将是更可观的。
1条答案
按热度按时间up9lanfz1#
在treetable中添加了toptoolbar和bottomtoolbar之后,我解决了这个问题。
如果addtoptoolbar方法中存在空值,则它将不起作用。
因此,应该使用可排序数据提供程序来定义它,该提供程序将解决此问题,以显示树表列标题显示问题。