Skip to Content
0
Former Member
Dec 14, 2007 at 05:51 AM

Table Node sorting Based on Column

60 Views

Hi,

I have a webdynpro table with Columns Document Name,Path,Hits. I want to sort the Table based on the Hits on descending order. I wrote a piece of code to sort it, but not getting sorted.

import java.util.Comparator;

wdContext.nodeKMAccess().sortElements(

new Comparator()

{

public int compare(Object x, Object y)

{

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

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

if (rx == null) return ry == null ? 0 : 1;

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

}

}

);

There is no error. But not getting sorted. I gave this code

wdContext.nodeKMAccess().sortElements(GenericNodeElementComparator.desc("Hits")

new Comparator()

But it is giving me an erorr. Can anyone help me out in solving this issue.

Regards,

Divya