cancel
Showing results for 
Search instead for 
Did you mean: 

Default sorting as per one column using tableSorter.java for NW2004

Former Member
0 Kudos

Hi,

Could anyone help with table sorter implementation?

It is working fine for me if I click on a table title.

The problem is: I need a default sort functionality as well. i.e on first display the table should be automatically sorted as per "Date" column (without a click on the column heading).

I am using TableSorter.java for NW2004 (Not 2004S).

Many thanks,

Anagha Jawalekar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Peter,

I have tried it before your post, yes this is the solution.

Thanks,

Anagha

Sunitkroy
Participant
0 Kudos

Hi

Sort the node where from you are taking data for displaying those in the table. I think the following code sample might help you where I sort the node Point by StartDate.

wdContext.nodePoint().sortElements(new Comparator() {public int compare(Object o1, Object o2)

{int i = 0;IPublicTpcalender.IPointElement e1 = ((IPublicTpcalender.IPointElement) o1); IPublicTpcalender.IPointElement e2 = ((IPublicTpcalender.IPointElement) o2);

i = e2.getStartDate().compareToIgnoreCase(e1.getStartDate());

return i; } //compare

});

regards

Sunit

Former Member
0 Kudos

Hi Sunit,

Thanks, this is helpful. I am able to sort my columns in descending order by this. The requirement is however to sort ascending. How can that be done?

Thanks

Anagha

Former Member
0 Kudos

i = <b>e1</b>.getStartDate().compareToIgnoreCase(<b>e2</b>.getStartDate());

Just switch e1 and e2.

regards,

Peter