Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Advanced filters with expressions
Advanced filters with expressions [message #1733969] Thu, 02 June 2016 14:25 Go to next message
Alain Bernard is currently offline Alain BernardFriend
Messages: 15
Registered: November 2013
Junior Member

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 #1733974 is a reply to message #1733969] Thu, 02 June 2016 14:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Have you configured the TextMatchingMode accordingly?

If you have a look at the _6032_GlazedListsFilterCustomTypesExample in you can see how it can be configured. In that example you are able to enter for example the following filter string "> 10 & < 30" and get all entries for persons with an age between 10 and 30.

To find it in the examples application: NatTable Examples -> Tutorial Examples -> GlazedLists -> Filter -> GlazedListsFilterCustomTypesExample
Re: Advanced filters with expressions [message #1733977 is a reply to message #1733974] Thu, 02 June 2016 14:55 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Oh, and regarding your question on the documentation ... well that is one of the biggest missing things in NatTable. I'm trying to work on it to even create a book, but everytime I want to write something more important comes up.
Re: Advanced filters with expressions [message #1734058 is a reply to message #1733977] Fri, 03 June 2016 11:59 Go to previous messageGo to next message
Alain Bernard is currently offline Alain BernardFriend
Messages: 15
Registered: November 2013
Junior Member

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 #1734059 is a reply to message #1734058] Fri, 03 June 2016 12:05 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
You can always use combo boxes. But the "Excel-like" combo box filtering also means that the combo boxes are automatically filled and the applied filters are different. Basically the filter logic is inverted at some points when looking into the details. And the combination of both is currently not supported out of the box. I was asked about that feature in the past, but the sponsor vanished shortly after, so I never started working on that.
Re: Advanced filters with expressions [message #1734205 is a reply to message #1734059] Mon, 06 June 2016 07:59 Go to previous messageGo to next message
Alain Bernard is currently offline Alain BernardFriend
Messages: 15
Registered: November 2013
Junior Member

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 #1734210 is a reply to message #1734205] Mon, 06 June 2016 08:38 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Sorry I'm a bit confused about what you are doing. Are you implementing regex filters or are you using Excel-like filters?

Also in the ticket you say that you create an editor, but you don't say how. The NatCombo has changed to add support for filtering inside the combo with 1.4. I thought we tested the various scenarios quite extensively, but maybe we missed a case. Also it looks like our examples are working correctly, otherwise it would be a critical bug because existing functionality would be broken.

It would be great if you could provide a small sample to reproduce the issue and attach it to the ticket.
Re: Advanced filters with expressions [message #1734211 is a reply to message #1734210] Mon, 06 June 2016 09:09 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
OK wait, you want to use multi-select with comboboxes on filtering with the default filter strategy. Is that correct?

But that is the Excel-like feature. The filter logic is different than typical filtering, therefore internally the filter is created in another way. Therefore in this case you use another filter strategy and different configuration. Which is the reason why the two concepts are not easily combinable.

So what are you trying to do? Excel-like filtering with multi-select comboboxes or typical filtering with text-boxes, or typical filtering with comboboxes (note that these don't work with multi-select
Re: Advanced filters with expressions [message #1734251 is a reply to message #1734211] Mon, 06 June 2016 14:40 Go to previous messageGo to next message
Alain Bernard is currently offline Alain BernardFriend
Messages: 15
Registered: November 2013
Junior Member

I think I was trying to make the typical filtering with comboboxes Smile 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.
Re: Advanced filters with expressions [message #1734254 is a reply to message #1734251] Mon, 06 June 2016 14:50 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Yes you are right. Basically that is the same as I tried to mention when you asked the first time. Wink

"Excel-like" == multiselect combobox filters

And the combination with default filters (textual or simple combobox) is currently not supported.
Previous Topic:NatTable 1.4.0 released
Next Topic:Copy/paste from external source
Goto Forum:
  


Current Time: Wed Sep 19 06:53:46 GMT 2018

Powered by FUDForum. Page generated in 0.01987 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top