Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Sort / Filter problem using Glazedlists (Sort / Filter problem using Glazedlists )
Sort / Filter problem using Glazedlists [message #1619086] Mon, 16 February 2015 10:24 Go to next message
Sathyanarayana Rengaraju is currently offline Sathyanarayana RengarajuFriend
Messages: 3
Registered: February 2015
Junior Member
I have a NatTable with Sort & Filtering capabilities .

The content of the NatTable would depend on the value selected in a SWT Combobox control outside the Nattable .

When NatTable is initialized , the Sort & Filtering functionalities work fine

But when I change the value in the Combobox and set the Datalayer & do a refresh Natable ( using a Event listener) , the content of the Nattable is displayed correctly . But I am unable to Sort / Filter .

Am i missing something ?
Re: Sort / Filter problem using Glazedlists [message #1619380 is a reply to message #1619086] Mon, 16 February 2015 14:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Yes, you are missing the fact how the data is referenced in the whole NatTable construct. You are saying that you are exchanging the DataLayer. But all the collections within, e.g. the SortedList and the FilterList reference the list that was used initially.

Instead of exchanging the DataLayer you need to operate on the data collection that you used to create the DataLayer. Typically clear() and addAll() are the methods to use.
Re: Sort / Filter problem using Glazedlists [message #1620793 is a reply to message #1619380] Tue, 17 February 2015 12:35 Go to previous messageGo to next message
Sathyanarayana Rengaraju is currently offline Sathyanarayana RengarajuFriend
Messages: 3
Registered: February 2015
Junior Member
Hi Dirk ,
Thanks for your response . Now , I have re-designed such as to re-instantiate Gridlayer ( all layers are formed under it and combined as Grid ) during the Combo Box Event listener . Though , I get the filter row in NatTable , filtering does not work fine . My problem persists.

Is there any sample code / example to demonstrate whatever you explained in your reply

Thanks
Sathya
Re: Sort / Filter problem using Glazedlists [message #1620805 is a reply to message #1620793] Tue, 17 February 2015 12:48 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
WHATEVER I EXPLAINED?!?!?

Sorry for asking the following questions, but it sounds like you are not quite familiar with object oriented programming.

Do you know how collections work in Java? Are you aware of what an object-relation is in Java? Do you know the Collections API?

Re-instantiating the GridLayer for exchanging the data that should be shown is completely wrong! You simply have to update the data in the collection!

You are creating a DataLayer using a DataProvider. Typically a ListDataProvider (since you are using GlazedLists). And that one needs a List at creation time. Instead of throwing everything away and re-creating it, you simply need to take that initial List and call List#clear() and List#addAll() with the new collection of data you want to show. And if your basic list is not a GlazedList, you need to call NatTable#refresh() to make the data change visible.
Re: Sort / Filter problem using Glazedlists [message #1620837 is a reply to message #1620805] Tue, 17 February 2015 13:19 Go to previous messageGo to next message
Sathyanarayana Rengaraju is currently offline Sathyanarayana RengarajuFriend
Messages: 3
Registered: February 2015
Junior Member
Hi Dirk ,
Thanks for your response . I am already getting the new data list and doing a nattable.refresh(); .And the table data is also fine as I mentioned in my first message .

I was asking for a sample code where an external widget event listener changes the behaviour of Nattable , since I could not find one in the Nattableexamples already in the Documentation .

Sorry ,that this lead to misunderstanding . (of your misconception about my understanding of Java / Java collections )

Regards
Sathya

Re: Sort / Filter problem using Glazedlists [message #1620859 is a reply to message #1620837] Tue, 17 February 2015 13:37 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Quote:
I am already getting the new data list and doing a nattable.refresh();


But you are saying that you are exchanging the DataLayer and even the whole GridLayer? Doesn't sound like exchanging the data but more like exchanging parts of the control.
If the filters are the issue, try to perform clear() and addAll() on the basic EventList. Maybe that helps to update everything accordingly. At least this is what I always do.

Quote:
I was asking for a sample code where an external widget event listener changes the behaviour of Nattable


No I don't think I have an example for that
Re: Sort / Filter problem using Glazedlists [message #1723966 is a reply to message #1619086] Fri, 19 February 2016 10:05 Go to previous messageGo to next message
Gopi Krishna Gobbilla is currently offline Gopi Krishna GobbillaFriend
Messages: 7
Registered: February 2016
Junior Member
Hello,

could you please post a sample code on how to get sorting and filtering capabilities together in nattable ? Thank you
Re: Sort / Filter problem using Glazedlists [message #1723990 is a reply to message #1723966] Fri, 19 February 2016 14:56 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
Check our examples application!
Previous Topic:Possibility to set the minimum size of column in ColumnResizeDragMode
Next Topic:Avoid to trim text in AbstractTextPainter
Goto Forum:
  


Current Time: Mon Mar 08 10:11:16 GMT 2021

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

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

Back to the top