Skip to Content

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

Table Node sorting Based on Column

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

replied

Hi Divya,

Use this

<a href="/people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s:///people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s

regards

Sumit

0 View this answer in context

Helpful Answer

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