简体   繁体   中英

GWT CELLTABLE : How to set columns descending icon on celltable header?

How to set columns descending icon ie DESC icon on celltable header ?

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

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

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

Any help or guidance in this matter would be appreciated

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM