Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to use a custom comparator in a TableSorter?

Hi,

I want to use a custom comparator for sorting a table by a specific column.

As you possibly know, the constructor for the TableSorter class looks like this:

TableSorter(IWDTable table, IWDAction sortAction, Map comparators);

As Map is an Interface I chose Hashmap as comparator container. So, I use the put(Key, Value) method to insert my own comparator into the Hashmap in order to deliver this Object to the TableSorter constructor.

But there is an essential problem:

I assume, that the column which is to be associated with my comparator is determined by the key of the Map object from the TableSorter constructor.

Presuming this, <u>what should the map key be/look like?</u>

An Integer counted from the columns? The column header as String? Whatever? Or am I on the wrong way?

PS:

Hours of search did not lead me to some kind of documentation or javadoc of the TableSorter class! This can't be, does someone have a link please?

Thanks a lot for any help.

Former Member
Not what you were looking for? View more on this topic or Ask a question