cancel
Showing results for 
Search instead for 
Did you mean: 

TableSorter - sortstate

former_member413959
Participant
0 Kudos

Hi,

I have 2 related questions :

1. How the sortstate is working(column property) ?

2. How to use initial sorting (first time) ?

Thanks,F.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Plz look at the below thread

former_member413959
Participant
0 Kudos

Hi All,

I forgot to mention that I know about the TableSorter class...

and I am using it in my applications...But what i need is :

1 . I want that the table will be sorted by X column in the first time.

Now just when we click the header the sort is working.

2. Multiple sorting

Can i do it with the TableSorter class ( NW7 )

Thanks,

F

sanyev
Active Participant
0 Kudos

Hi,

You cannot do multiple sorting with the TableSorter class. Also there is no configuration in the tablesorter class to sort at load. You will have to implement both by your own.

TableSorter class basically does a sort on the context node. So for multiple field sort you will have to manipulate the sort order yourself. For initial sorting you can use the tablesorter class.

Regards,

Sanyev

former_member413959
Participant
0 Kudos

Hi Sanyev,

I didnt understand, what is "For initial sorting you can use the tablesorter class" ?

Are you mean that I can use the class for the first time (do init) ? How ?

Thanks

Former Member
0 Kudos

.

Former Member
0 Kudos

Hi F,

I cant exactly get what you mean by firsttime X column sorting , but i suppose you want the table to be sorted when loaded , you can code it in wdDoModifyView method ,

> if (firstTime) {

> IWDTable table = (IWDTable) view.getElement("XXX");

> wdContext.currentContextElement().setTableSorter(new TableSorter(table,wdThis.wdGetSortAction(),null));

where firsttime is a boolean variable passed as a parameter to that wdDoModifyView method itself

Hope this answer is relevant to your question as i havn't got ur question clearly !!!!

Regards,

Sam Charles J.

sanyev
Active Participant
0 Kudos

Hi F.F,

What I meant was that you can use the methods of TableSorter class to initially sort your table when you load your application. You don't have to write your own sorting algorithm to achieve this. But for multiple sorting TableSorter class is useless. You will have to implement your own sorting algorithm.

Sanyev

sanyev
Active Participant
0 Kudos

Hi F.F,

Please go through [this|; post. Here I have mentioned how you can do initial sort with the TableSorter class. You will have to modify the TableSorter.java file and add a new method in it. Details are there in the my post. Link given above.

Regards,

Sanyev

Former Member
0 Kudos

Hi

check this blog for Table Sorter

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f024364b-3086-2b10-b2be-c0ed7d33...

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

Edited by: Tulasi Palnati on Feb 3, 2009 7:18 AM

Former Member
0 Kudos

Hi F,

1. Regarding the working of sorting ,

you will be creating a attribute for tablesort and giving its type as com.sap.tc.webdynpro.tests.utils.TableSorter under java native type.

You will find the program code for the sort class under src u2192 packages in the package com.sap.tc.webdynpro.tests.utils.TableSorter.

2. Regarding the firsttime sorting,

See the following link,

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-tec...

Where in page no 18, they used the code to sort the table in wdDoModifyView method, there the variable firstTime is a boolean variable passed as a parameter in the methos wdDoModifyViewitself. thus the first time sorting works.

follow that link for complete table sort procedure !

Regards,

Sam Charles J.

sanyev
Active Participant
0 Kudos

Hi F,

You can read through this blog about TableSorter in Webdynpro Table.

[https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3287] [original link is broken] [original link is broken] [original link is broken];

In a Webdynpro table you have to implement your own sorting. Already implemented sorter classes like the one mentioned in the blog above are available and the developer can just use those.

For your first question, If initially sortstate is set then a sort icon will be visible in the table column. When ever the user click the sort icon you will get an event and the event handler can do the sorting of the data. When the user clicks the the sort state of the IWDTableColumn will change and can be read using the getSortState() api.

You will have to do the initial sorting. If you want the first column to be sorted on load then you will have to set the appropriate sort state of that column and do the sorting.

Hope this helps.

Regards,

Sanyev