table.getColumnSortList().push(testColumn)
列に並べ替え情報が設定されていない場合に呼び出すと、並べ替えが昇順に設定されます。もう一度呼び出すと、ソート順が逆になります。
// Show the descending sort icon on a column.
ColumnSortInfo sortInfo = table.getColumnSortList().push(testColumn);
if (sortInfo.isAscending()) {
table.getColumnSortList().push(testColumn);
}
変数 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);
}