Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Disabling sorting on selected columns
Disabling sorting on selected columns [message #1065399] Tue, 25 June 2013 14:52 Go to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Hi,

I am using tree grid in my application and I want to enable sorting only on specific columns. To achieve this I have added label(say SORT) on columns that I want sorting to be enabled and registered this attribute

configRegistry.registerConfigAttribute( SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator(), DisplayMode.NORMAL,	"SORT"  );


To disable sorting on columns, I have registered NOSORT label.

configRegistry.registerConfigAttribute( SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator(), DisplayMode.NORMAL,	"NOSORT"  );


As specified in the example single click sorting is enabled like,

nattable.addConfiguration( new SingleClickSortConfiguration() );


But this enables sorting on all columns. Is this the correct way to disable sorting?
Re: Disabling sorting on selected columns [message #1065412 is a reply to message #1065399] Tue, 25 June 2013 15:39 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
http://eclipse.org/nattable/documentation.php?page=sorting
Re: Disabling sorting on selected columns [message #1065415 is a reply to message #1065412] Tue, 25 June 2013 15:40 Go to previous messageGo to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Dirk,

Thats what I followed exactly and I have this issue. I am using Nattable 1.0.0
Re: Disabling sorting on selected columns [message #1065416 is a reply to message #1065415] Tue, 25 June 2013 15:45 Go to previous messageGo to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Sorry the code had the type when I pasted here. For NOSORT, I registered new NULLComparator.


 Disabling sorting on selected columns [message #1065399]	Tue, 25 June 2013 10:52 
 Testr t
Messages: 50
Registered: April 2013	
Member
Hi,

I am using tree grid in my application and I want to enable sorting only on specific columns. To achieve this I have added label(say SORT) on columns that I want sorting to be enabled and registered this attribute 

Code: [Select all] [Show/ hide]
configRegistry.registerConfigAttribute( SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator(), DisplayMode.NORMAL,	"SORT"  );


To disable sorting on columns, I have registered NOSORT label. 

Code: [Select all] [Show/ hide]
configRegistry.registerConfigAttribute( SortConfigAttributes.SORT_COMPARATOR, new NullComparator(), DisplayMode.NORMAL,	"NOSORT"  );
Re: Disabling sorting on selected columns [message #1065417 is a reply to message #1065416] Tue, 25 June 2013 15:47 Go to previous messageGo to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Also When I use DebugMenuConfiguration I correctly see the SORT and NOSORT labels on the columns. But I do not see these lables on column header, is it also needed there to work correctly?
Re: Disabling sorting on selected columns [message #1065419 is a reply to message #1065417] Tue, 25 June 2013 15:54 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well it works in the SortableGridExample. It might be just an issue with your composition. Maybe double check the example with your code.
Re: Disabling sorting on selected columns [message #1065459 is a reply to message #1065419] Tue, 25 June 2013 18:55 Go to previous messageGo to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
Okay, I figured out the problem. I had the CellLabelAccumulator(implementing IConfigLabelAccumulator) which adds the labels to the data layer(all my labels are added in this class and it works well). But the sorting header configuration does not work based on this configuration, but it works if I add the ColumnOverrideLabelAccumulator on the ColumnHeaderDataLayer. Its okay for me to add the label in two places, but just want to know if this is a bug or by design.
Re: Disabling sorting on selected columns [message #1065472 is a reply to message #1065459] Tue, 25 June 2013 20:48 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Why should it be a bug? The header layer stack is different to the body layer stack. They are different regions and therefore different cells where you apply your labels. I don't understand why you need to add the label in two places.
Re: Disabling sorting on selected columns [message #1065480 is a reply to message #1065472] Tue, 25 June 2013 21:45 Go to previous messageGo to next message
Testr t is currently offline Testr tFriend
Messages: 93
Registered: April 2013
Member
By two places, I meant I had to register the "Sort" and "NoSort" labels on the column header layer and the other labels(to set combo box editors, styling) on the body layer. Since in the cell state accumulator, I have the column indexes, I assumed setting "Sort" and "NoSort" labels would work, but it looks like it does set to the header cells.
Re: Disabling sorting on selected columns [message #1065481 is a reply to message #1065480] Tue, 25 June 2013 21:49 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Yes of course. As I explained, they are separate layer stacks.
Previous Topic:SelectCellCommand issue with TextPainter calculateByTextHeight
Next Topic:Display values in GroupBy tree nodes
Goto Forum:
  


Current Time: Thu Apr 18 07:05:17 GMT 2024

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

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

Back to the top