0
votes

How to set columns descending icon i.e. DESC icon on celltable header ?

On celltable loading.. I want to set sorting order to column i.e. previously sorted column/sorting order by user (In last login , before logout)

I tried following way table.getColumnSortList().push(testColumn); i.e setting column ascending to true with ASC Icon on top of header.It works fine

Now I want to set column in descending i.e DESC icon on top header ? How to do it ?

Any help or guidance in this matter would be appreciated

1

1 Answers

0
votes

When you call table.getColumnSortList().push(testColumn) if no sort info is set on the column it sets the sort to ascending. If you call it another time it reverses the sort order.

// Show the descending sort icon on a column.
ColumnSortInfo sortInfo = table.getColumnSortList().push(testColumn);
if (sortInfo.isAscending()) {
    table.getColumnSortList().push(testColumn);
}

To set the sort icon according to state saved in variable sortOrder:

// Assuming sortedOrder = true means ascending
// and sortedOrder = false means descending
ColumnSortInfo sortInfo = table.getColumnSortList().push(testColumn);
if (sortedOrder && !sortInfo.isAscending()) {
    table.getColumnSortList().push(testColumn);
}
else if (!sortedOrder && sortInfo.isAscending()) {
    table.getColumnSortList().push(testColumn);
}