Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » how to create a custom filter
how to create a custom filter [message #1818532] Thu, 19 December 2019 03:27 Go to next message
zida wang is currently offline zida wangFriend
Messages: 7
Registered: November 2019
Junior Member
I want to add a filter to my popupmenu which can filter the cell text,but i don't know how to do it .I think it may be create a command,but I don't know what to do next ,I want to use NatTable 's filter
Re: how to create a custom filter [message #1818535 is a reply to message #1818532] Thu, 19 December 2019 05:38 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
If you want to programmatically filter using GlazedLists you need to pass a Matcher or MatcherEditor to the FilterList. If you have also the filter row in place that would interfere with the defaults. For such cases we have the DefaultGlazedListsStaticFilterStrategy where you can pass a Matcher that works in combination with the filter row.
Re: how to create a custom filter [message #1818583 is a reply to message #1818535] Fri, 20 December 2019 07:08 Go to previous messageGo to next message
zida wang is currently offline zida wangFriend
Messages: 7
Registered: November 2019
Junior Member
If I use DefaultGlazedListsStaticFilterStrategy,I need to use FilterRowHeaderComposite but,I want to use MenuItem ,When I click the menuitem,filter the selected cell text
Re: how to create a custom filter [message #1818584 is a reply to message #1818583] Fri, 20 December 2019 08:01 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Then pass the matcher directly to the FilterList. There is no default implementation for that. You have to impl it yourself
Re: how to create a custom filter [message #1818638 is a reply to message #1818584] Sat, 21 December 2019 03:20 Go to previous messageGo to next message
zida wang is currently offline zida wangFriend
Messages: 7
Registered: November 2019
Junior Member
Here's my code
EventList eventlist =new BasicEventList(myDatas);
Matcher matcher =new FilterMatcher(myDatas);
FilterList filterlist =new FilterList (eventlist,matcher);
DefaultGlazedListStaticFilterStrategy strategy = new DefaultGlazedListStaticFilterStrategy (filterlist,accessor, new ConfigRegistry());
strategy.applyFilter(map);
but it didn't work. the filterlist's size always is 0.
Re: how to create a custom filter [message #1818640 is a reply to message #1818638] Sat, 21 December 2019 06:59 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I thought you don't want to use the DefaultGlazedListStaticFilterStrategy. If you don't want the filter row it is not needed. You only need the matcher on the FilterList.

Probably the Matcher is not correct. For example I don't understand why you pass the FilterList as parameter. Check for the GlazedLists documentation to see how plain filtering works.
Previous Topic:Nattable saveState and loadState issue
Next Topic:NPE while saving State (with Filters
Goto Forum:
  


Current Time: Fri Apr 19 23:45:55 GMT 2024

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

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

Back to the top