Skip to Content
0
Former Member
Dec 21, 2007 at 07:33 AM

Table Sorting

63 Views

HI all, I am trying to sort the table using comparator. Below is the code used for sorting. However the last document is not sorted in the proper order.The Output is also given for reference. Can Anyone help me in this.

wdContext.nodeKMAccess().sortElements(

new Comparator()

{

public int compare(Object x, Object y)

{

int iX,iY;

IPrivateDownloadKMHitsReportView.IKMAccessElement rx = (IPrivateDownloadKMHitsReportView.IKMAccessElement)x;

IPrivateDownloadKMHitsReportView.IKMAccessElement ry = (IPrivateDownloadKMHitsReportView.IKMAccessElement)y;

iX = Integer.parseInt(rx.getHits());

iY = Integer.parseInt(ry.getHits());

while(rx.getHits()!=null && ry.getHits()!=null)

{

rx.getHits().compareTo(ry.getHits());

}

return iY-iX;

but output is coming as

11

10

8

6

4

3

1

2

Regards,

Kamini