cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting table according 2 columns

Former Member
0 Kudos

Hello,

I am using the TableSorter object in order to sort Dynpro tables.

Suppose I have requirement to sort according 2 columns,

I mean one primary and second secondary.

The situation now is every click on another column cancel the first sort.

I'll appreciate any suggestion.

Thanks,

Maya.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member751941
Active Contributor
0 Kudos

Hi Maya,

Check this links.

/people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s

Regards,

Mithu

Former Member
0 Kudos

You can use sort method on your data node like:

node.sortElements(new Comparator() {

public int compare(Object o1, Object o2) {

<MyElType> el1 = (MyElType) o1;

<MyElType> el2 = (MyElType) o2;

if(e1.getClm1().compareTo(e1.getClm1())==0) {

// sort by second column only if in first column we have the equals values

return e1.getClm2().compareTo(e1.getClm2());

} else {

return e1.getClm1().compareTo(e1.getClm1());

}

}

}

}

}

Former Member
0 Kudos

Hi,

What about creating a pushbutton that when pressed will trigger a pop-up dialog box. In this box list the column headers and the user can enter a number next to each column header to define the sort order?

It's not ideal but will achieve sorting on multiple columns.

Gareth.