Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Enable Filter Row, not filtering data due to conflict with matcher editor object(Enable Filter Row, how to set same matcher editor object for DefaultGlazedListFilterStrategy and filter list using "enable filter row" option of nattable builder)
Enable Filter Row, not filtering data due to conflict with matcher editor object [message #1060774] Tue, 28 May 2013 08:09 Go to next message
SD Khan is currently offline SD Khan
Messages: 63
Registered: May 2013
Member
Hi All,

I have created the "TableModel" (org.eclipse.nebula.widgets.nattable.extension.builder.model.TableModel) instance and associate it with the nattable , then i have used "enable filter row" option as true, so filter appears at the top of every column and it works fine.

For custom filtering i have implemented "IFilterStrategy" interface and done following steps to get it work.

// created a filter list object
FilterList<? extends TableRow> filterList = getTable().getFilterList();

//created a matcherEditor to perform matching.
CompositeMatcherEditor<TableRow> matcherEditor = new CompositeMatcherEditor<TableRow>();

//initializing my custom filterStrategy object
filterStrategy = new XYFilterStrategy<TableRow>(matcherEditor);

//setting the matcher to filterlist.
filterList.setMatcherEditor(matcherEditor);

//applied filter
filterStrategy.applyFilter(filterMap);

Now, the above code works fine as well but the problem is when i use the above code and then use that built in feature of "enable filter row" then "enable filter row" doesn't work.

I have debug the problem and found that when this line executes
filterList.setMatcherEditor(matcherEditor);

filter list has a new object of "CompositeMatcherEditor" but when "enable filter row" executes it pass the same old object of "CompositeMatcherEditor" that is created in the start at the time of setup layering mechanism to "DefaultGlazedListFilterStrategy" and as filter list has a different object of "CompositeMatcherEditor" assigned to it while
"DefaultGlazedListFilterStrategy" has old object so "enable filter row" stops working while my custom filtering continue to work.

Now issue is that "DefaultGlazedListFilterStrategy" and "FilterList" have different object of "CompositeMatcherEditor" at the time when "enable filter row" apply filtering, but they should be same so it can work properly along with my custom filtering.

How I can achieve this , any kind of suggestion will be appreciated.

Note:- I am using nattable builder api to create nattable.

Thanks,
Safdar Khan
Re: Enable Filter Row, not filtering data due to conflict with matcher editor object [message #1060781 is a reply to message #1060774] Tue, 28 May 2013 08:29 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1213
Registered: July 2012
Senior Member
Hi,

we do not publish the NatTable Builder API. Therefore we do not support or maintain it. It is in our codebase because someone started it sometime. But today, nobody feels responsible for it.

With the 1.0.0 release you are not forced to download the sources and build NatTable yourself anymore. You should use the p2 update site then, and there is definitely not builder API. So your code is also not future safe.

I'm really sorry to tell you this, but if you want to rely on the proprietary builder API, you need to take care of that stuff yourself.

Greez,
Dirk
Re: Enable Filter Row, not filtering data due to conflict with matcher editor object [message #1060787 is a reply to message #1060781] Tue, 28 May 2013 08:37 Go to previous messageGo to next message
SD Khan is currently offline SD Khan
Messages: 63
Registered: May 2013
Member
Okay thanks, i got it, but we are using nattable builder api extensively in our application and as nattable builder api give some built in features like column management, row filtering, searching, etc.., so what about these features ? as we have written a lot of code on top of it and as you said so there is no further release of nattable builder api ?

Thanks,
Safdar Khan
Re: Enable Filter Row, not filtering data due to conflict with matcher editor object [message #1060793 is a reply to message #1060787] Tue, 28 May 2013 08:49 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1213
Registered: July 2012
Senior Member
These are all features of NatTable core and the extensions. The builder API is only a wrapper around that. AFAIK the builder API was started for convenience, to make it easier to create and configure a NatTable instance. But it simply uses the core and extension features.
Re: Enable Filter Row, not filtering data due to conflict with matcher editor object [message #1060806 is a reply to message #1060793] Tue, 28 May 2013 09:24 Go to previous messageGo to next message
SD Khan is currently offline SD Khan
Messages: 63
Registered: May 2013
Member
sorry, i got a little confused, yup, you are right about the nattable core and extension features.

Thanks,
Safdar Khan
Re: Enable Filter Row, not filtering data due to conflict with matcher editor object [message #1060817 is a reply to message #1060806] Tue, 28 May 2013 09:53 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1213
Registered: July 2012
Senior Member
No problem.

BTW, if you want to combine the features of the filter row and a custom filtering you should take a look at the DefaultGlazedListsStaticFilterStrategy which allows to specify additional filters alongside the filter row.

This is also something the builder API does not know for example.
Previous Topic:nattable in high resolution
Next Topic:Installing the 1.0 release
Goto Forum:
  


Current Time: Fri Jul 25 11:27:32 EDT 2014

Powered by FUDForum. Page generated in 0.02502 seconds