当我单击筛选器单元格然后在未输入筛选器字符串的情况下移至视图中的其他区域时,即使我没有输入字符串,单元格中也会显示“清除筛选器”图标。如下面给出的 Nattable 所示,启用了图标的过滤列没有输入任何过滤字符串。有没有办法在 FilterRowConfiguration 中明确禁用此行为?
我在该示例的第一列的
_6031_GlazedListsFilterExample
中发现了类似的行为。但是,该示例中的其他列没有按预期显示“清除过滤器”图标。
粘贴我的 FilterRowConfiguration 的内容
final DefaultIntegerDisplayConverter idc = new DefaultIntegerDisplayConverter();
final DefaultLongDisplayConverter ldc = new DefaultLongDisplayConverter();
@Override
public void configureRegistry(IConfigRegistry configRegistry)
{
for (int i = 0 ; i < propNames.size() ; i++)
{
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + i);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
new LinkerMapFilterRowRegexConverter(), DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + i);
}
configRegistry.registerConfigAttribute( // comparator
FilterRowConfigAttributes.FILTER_COMPARATOR,
Comparator.nullsLast(new DefaultComparator()), DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + propNames
.indexOf(ILinkerMapConstants.PROP_KEY_SYMBOL_SIZE));
configRegistry.registerConfigAttribute( // filter display converter
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER, idc,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + propNames
.indexOf(ILinkerMapConstants.PROP_KEY_SYMBOL_SIZE));
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + propNames
.indexOf(ILinkerMapConstants.PROP_KEY_SYMBOL_SIZE));
configRegistry.registerConfigAttribute( // comparator
FilterRowConfigAttributes.FILTER_COMPARATOR,
Comparator.nullsLast(new DefaultComparator()), DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + propNames
.indexOf(ILinkerMapConstants.PROP_KEY_SYMBOL_ADDRESS));
configRegistry.registerConfigAttribute( // filter display converter
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER, ldc,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + propNames
.indexOf(ILinkerMapConstants.PROP_KEY_SYMBOL_ADDRESS));
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + propNames
.indexOf(ILinkerMapConstants.PROP_KEY_SYMBOL_ADDRESS));
}
您应该仔细检查
FilterRowDataProvider
中的支持数据是否真的没有价值。调试显示过滤器图标的原因。因为只有在支持数据中设置了值时它才会显示。