开发者

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

开发者 https://www.devze.com 2023-04-11 03:05 出处:网络
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

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


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

精彩评论

暂无评论...
验证码 换一张
取 消