Advanced filters with expressions [message #1733969] |
Thu, 02 June 2016 14:25 |
|
Hi,
I have found this discussion thread on the old sourceforge forum about enabling multiple filters in the NatTable using also numeric expressions and so on:
https://sourceforge.net/p/nattable/discussion/744992/thread/1e4ea778/
The feature seems impressive and it seems to be integrated in the NatTable API when I dig into it, but I didn't find the way to enable it. All my tests have failed so I'm wondering whether I use the good method:
I started to call the FilterRowHeaderComposite constructor with the additional parameter to create some MatcherEditor:
FilterRowHeaderComposite<T> filterHeaderLayer = new FilterRowHeaderComposite<T>(
new DefaultGlazedListsFilterStrategy<T>(dataProvider.getWrappedFilterList(), getCompositeMatcherEditor(),
dataProvider.getColumnAccessor(), builder.getConfigRegistry()),
topLayer, super.getDataProvider(), builder.getConfigRegistry());
public CompositeMatcherEditor<T> getCompositeMatcherEditor() {
@SuppressWarnings("unchecked")
EventList<MatcherEditor<T>> matchers = GlazedLists.eventListOf((MatcherEditor<T>)new RangeMatcherEditor<Double, T>(), (MatcherEditor<T>)new TextMatcherEditor<T>());
return new CompositeMatcherEditor<T>(matchers);
}
But the behavior does not change in my NatTable, filtering is still done using basic text matcher. I also seen some discussions about "regex" based filtering.
Do you have any tips on how to enable these capabilities, what I have to modify/enable to make it work? I have not found in it the online doc nor in the examples source code but maybe I just looked at the wrong place!
Alain
|
|
|
|
|
Re: Advanced filters with expressions [message #1734058 is a reply to message #1733977] |
Fri, 03 June 2016 11:59 |
|
Thank you for the tip, it works perfectly now. One more thing: is it possible to combine both the "Excel-like" combo box filtering on some columns and the "classic" filter on others.
For example, I (now) have a useful filter for numeric values, and I would like to have an Excel-like filter for some specific columns that contain text.
|
|
|
|
Re: Advanced filters with expressions [message #1734205 is a reply to message #1734059] |
Mon, 06 June 2016 07:59 |
|
Hi Dirk
Thank you for the tip. I've set up my combo for filtering (and also raisednthis bug, but used a workaround now). But when I select one or more values, no values are displayed anymore in the table. If I deactivate the "multiselect" property of the combo, filter works perfectly, but if I activate it, it doesn't work anymore, even if I only select one item. Any clue?
|
|
|
|
|
Re: Advanced filters with expressions [message #1734251 is a reply to message #1734211] |
Mon, 06 June 2016 14:40 |
|
I think I was trying to make the typical filtering with comboboxes So it seems to be not supported.
So today, I have two solutions:
- either I apply the "Excel-like" filter strategy on ALL columns
- either I keep the possibility to make numeric filters as explained in the first post and I cannot combine it with multi-select combo boxes
Am I right ?
It's fine for me (at least for my experiments today!) but it is just to be sure to well understand the mechanisms.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04156 seconds