cancel
Showing results for 
Search instead for 
Did you mean: 

Table sorter-How to display the first page when user clicks on sorter

Former Member
0 Kudos

Hi Experts,

I have created WD program and added table sorter in it. I have used following PDF for creation of table sorter.

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/90ac0015-d1c5-2a10-d788-aed89990811d&override...

Initially the UI displays following records:

Name   Emp No  Salary  
Adam              576        109
Barmith            989        879
----------
----------

Now when I am clicking on Emp No field of sorter, the 10,000 records of table get sorted in ascending order of Emp No.

However the UI still shows the first record (highlighted row) as shown below. This record of "Adam" is in 10th page of table.

Name   Emp No  Salary  
Adam   576        109
Smith    989        879
----------
----------

User has to click on "First Row" button to view record of Emp No 1.

My requirement is as below:

1) Initially the table UI will display the table records in any way. Any random row will be selected and highlighted as first row.

2) User will click on Emp No sorter (ascending). The record of table should get sorted in ascending order of Emp No.

3) Table UI should display the first page of table and cursor should be on the Emp No 1

Please help.

Regards,

Gary

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gray,

you have to write the following code to solve your problem in onActionSort() function

public void onActionSort(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionSort(ServerEvent)
	wdContext.currentContextElement().getTableSorter().sort(wdEvent,wdContext.nodeProducts());

                     //Set Lead Selection to 1st Element
	wdContext.nodeProducts().setLeadSelection(0);
    //@@end
  }

setLeadSelection() method will help you to select the 1st row of the table.

Hope this helps you

Regards,

Sruti

Answers (0)