有没有办法在Nattable过滤行中当没有过滤字符串时禁用’clear filter’图标?

huangapple go评论61阅读模式
英文:

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?

Nattable

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.

huangapple
  • 本文由 发表于 2023年5月17日 15:26:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76269516.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定