Swt table disables arrow sorting in column header

I have the following code that allows me to sort columns in my table in ascending or descending order.

protected void setSortColumn(GridPanelColumn gridPanelColumn, TableColumn column) { table.setRedraw(false); // check if already selected if (sortGridPanelColumn != null && sortGridPanelColumn == gridPanelColumn) { // toggle sort order sortAscending = !sortAscending; } else { // set new sort column sortGridPanelColumn = gridPanelColumn; sortAscending = false; table.setSortColumn(column); } // set sort direction table.setSortDirection(sortAscending ? SWT.UP : SWT.DOWN); // refresh table tableViewer.refresh(); table.setRedraw(true); } 

The only problem is that when the user clicks on the column heading to sort, the arrow causes the column name to dodge (for example: Ccy .. ^) instead of (CCy1 Amount). Is there a way to disable the arrow display? I would rather not worry about resizing the columns of the grid just to accommodate the arrows so that the dots do not form.

Any ideas on how to do this?

+4
source share
1 answer

Simple! Just don't do

  table.setSortDirection(sortAscending ? SWT.UP : SWT.DOWN); 

When you call this method, you simply tell SWT which image to use. Without it, sorting still works, but the arrows do not appear.

+4
source

Source: https://habr.com/ru/post/1338822/


All Articles