Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

swt table turn off sort arrows in column header

I have the following code which allows the columns in my table to sort by 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 header to sort, the arrow causes the column name to dot out (ex: Ccy..^ ) instead of (CCy1 Amount). Is there any way to turn off the showing of the arrows? I would rather not have to bother with resizing my grid columns just to accommodate for the arrows so that the dots don't form..

Any ideas on how to do this?

like image 723
codegurl Avatar asked Feb 08 '11 10:02

codegurl


1 Answers

Simple! Just do not do

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

When you call this method, you're just telling SWT which image to use. Without it, the sorting still works, but the arrows do not show.

like image 126
Mario Marinato Avatar answered Nov 01 '22 10:11

Mario Marinato