英文:
Is there a way to disable the 'clear filter' icon in Nattable filter row when there is no filter string?
问题
当我点击一个筛选单元格然后切换到视图的不同区域而没有输入筛选字符串时,即使我没有输入字符串,'清除筛选'图标仍然显示在单元格中。如下所示,在给定的Nattable中,启用图标的筛选列没有输入任何筛选字符串。在FilterRowConfiguration中是否有一种明确禁用此行为的方法?
我在_6031_GlazedListsFilterExample
中的第一列中发现了类似的行为。然而,该示例中的其他列不像预期的那样显示'清除筛选'图标。
粘贴了我的FilterRowConfiguration的内容:【代码部分不翻译】
英文:
When I click on a filter cell and then move on to a different area in my view without entering a filter string, the 'clear filter' icon is displayed in the cell even when I haven't entered a string. As shown in the Nattable given below, the filter columns having the icon enabled do not have any filter strings entered. Is there a way to explicity disable this behavior in the FilterRowConfiguration?
I found a similar behavior in the _6031_GlazedListsFilterExample
for the first column in that example. However, the other columns in that example do not show the 'clear filter' icon as expected.
Pasting the contents of my 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));
}
答案1
得分: 0
你应该仔细检查FilterRowDataProvider
中的后备数据是否真的没有值。调试一下为什么筛选图标显示出来了。因为它应该只在后备数据中设置了值的情况下显示出来。
英文:
You should double check if there is really no value in the backing data in the FilterRowDataProvider
. Debug why the filter icon is displayed. Because it should only show up if a value is set in the backing data.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论