Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324634 - Unable to sort non-moveable columns
Summary: Unable to sort non-moveable columns
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-07 06:15 EDT by Peer Törngren CLA
Modified: 2021-07-05 11:38 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peer Törngren CLA 2010-09-07 06:15:43 EDT
Build Identifier: 20100617-1415

Due to what appears to be a bug (or at least counter-intuitive behavior) in
the Grid, the column must be moveable in order to be sortable. This appears to be because the code in 'Grid.handleColumnHeaderPush(int, int)' explicitly checks if the column is movable, and bails out to disable "column header push" behavior if it isn't. Hence, no "selection events" are sent unless the column is movable. 

This makes sense in order to disable "push" for moving, but it also disables sorting. The same (false) assumption is made elsewhere; a non-movable grid column is rendered flat to indicate that it cannot be pushed - but you may still want to push it in order to sort it.

This is the actual code in 'Grid.handleColumnHeaderPush(int, int)':

if (cellSelectionEnabled && overThis.getMoveable() == false) {
    return false;
}


Reproducible: Always

Steps to Reproduce:
1. Create a default grid
2. Make the columns non-movable (setMoveable(false))
3. Add a SelectionListener to the column, have it print all events on System out
4. Run the grid and click the column - no events are printed
5. column.setMoveable(true)
6. Run the grid and click the column - events are printed
Comment 1 Thomas Schindl CLA 2010-09-18 16:27:03 EDT
You are right this makes no sense so I removed the code and released the change
Comment 2 Deryck Brown CLA 2012-03-22 10:02:01 EDT
Build Identifier 20120319-1429

It would appear that this fix has had the side-effect of breaking column selection when in cell selection mode.

With no reference to cellSelectionEnabled in Grid.handleColumnHeaderPush, this method now always consumes the mouse down, and so control never passes to the later code in Grid.onMouseDown that deals with column selection, namely:

6841: else if (cellSelectionEnabled && e.button == 1&& columnHeadersVisible && e.y <= headerHeight) ...

As per other discussions, selection events should not be fired when in cell selection mode and the cell header is clicked.
Comment 3 Thomas Schindl CLA 2012-03-22 11:25:07 EDT
looks like this introduce a regresion
Comment 4 Adriaan Peeters CLA 2012-09-14 06:23:17 EDT
I created a naive fix for the regression in https://github.com/apeeters/nebula/tree/fix_column_selection

It utilizes GridColumn.getSort() to determine whether column sorting is enabled.
Comment 5 Laurent CARON CLA 2019-09-30 11:40:13 EDT
Not reproductible today, I suppose it has been fixed