0

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

StackOverFlow
  • 4,486
  • 12
  • 52
  • 87

1 Answers1

0

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);
}
Ioan Agopian
  • 788
  • 5
  • 9
  • Thanks for reply. jonic above code is used for flipped the order. My problem is that I want to show sorted order of column after celltable loading. eg. I have xml. I am getting only one column information i.e column(columnname, sortedOrder[false/true],dataTypeOf) as per column information I want to set ASC/DESC icon close to Column as per value. – StackOverFlow Oct 05 '11 at 09:08