gpt4 book ai didi

java - Vaadin 中的 FilterTable 和 SQLcontainer

转载 作者:行者123 更新时间:2023-12-02 04:32:16 25 4
gpt4 key购买 nike

我在 Vaadin 中创建了简单的 FilterTable:

    private static final String COL1_PROP = "date";
private static final String COL2_PROP = "name";
private static final String COL3_PROP = "status";

//............

final FilterTable fooTable= new FilterTable();
fooTable.setImmediate(true);
fooTable.setSelectable(true);
fooTable.setWidth("100.0%");
fooTable.setHeight("100.0%");

fooTable.setColumnHeader(COL1_PROP, "Date");
fooTable.setColumnHeader(COL2_PROP, "Name");
fooTable.setColumnHeader(COL3_PROP, "Status");

fooTable.setFilterBarVisible(true); //show filters
fooTable.setFilterFieldVisible(COL1_PROP, false); //hide col1_prop column filter

fooTable.setColumnCollapsingAllowed(true); // allow collapsing
fooTable.setColumnCollapsed(COL3_PROP, true); // collapse col3_prop column

fooTable.setContainerDataSource(container);

fooTable.setColumnExpandRatio(COL1_PROP, 1.0f);
fooTable.setColumnExpandRatio(COL2_PROP, 2.0f);

我的容器是一个SQLConterner,其查询如下:

SELECT date, name, status FROM foo

我得到的数据没有问题,但是,我想完全隐藏Status列。更重要的是我想隐藏 Date 列过滤器。正如我所认为的,带有注释的行可以做到这一点。但事实并非如此。我在表中得到了完整的 3 列,并且所有这些列都有可用的过滤器。

出了什么问题?

最佳答案

将注释行移至 setContainerDataSource 调用下方。

关于java - Vaadin 中的 FilterTable 和 SQLcontainer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31311567/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com