java 当没有过滤器字符串时,是否有方法禁用Nattable过滤器行中的“清除过滤器”图标?

wfveoks0  于 2023-05-21  发布在  Java
关注(0)|答案(1)|浏览(107)

当我点击一个过滤器单元格,然后移动到视图中的另一个区域而没有输入过滤器字符串时,即使我没有输入字符串,“清除过滤器”图标也会显示在单元格中。如下面给出的Nattable所示,启用了图标的过滤器列没有输入任何过滤器字符串。是否有方法在FilterRowConfiguration中显式禁用此行为?
Nattable
我在该示例的第一列的_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));

        }
ubof19bj

ubof19bj1#

您应该仔细检查FilterRowDataProvider的后台数据中是否真的没有值。调试显示筛选器图标的原因。因为只有在后台数据中设置了一个值时才应该显示它。

相关问题