cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in sorting of table data

Former Member
0 Kudos

Hi all,

I had gone through the PDF given (Developing with tables in webdynpro).

i got struck in creating TableSorter.java file...

can any one tell me how to create that java file in my project and how to send the colum which i want to sort to TableSorter.java

Regards

Padma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

To implement it ,create a value attribute say "sorter" of java native type

com.sap.tc.webdynpro.tests.utils.TableSorter. (The package name MIGHT be different.)

In wdDoModifyView,obtaine a refernce to the table objject like

table = (IWDTable)view.getElement("table ui name);

and use

wdContext.currentContextElement().setSorter(

new TableSorter(table, wdThis.wdGet

<action name for sort>Action(), null));

Now inside that action handler,

wdContext.currentContextElement().getTableSorter().sort(wdEvent,

wdContext.node<nodename>());

also chk it

null

Former Member
0 Kudos

Hi,

i created all these which you mentioned.But i simply copied the code of TableSorter.java into my project.But nocolumn in the table is getting sorted

I am not understanding where we are sending the coulmn which we want to sort out of many colums

I am not understanding the code written in TableSorter.java

Former Member
0 Kudos

By default the TableSorter automatically makes all table columns sortable (i.e. all context attributes). You just have to use the first constructor which does not have the String array parameter (IDs of sortable columns).

public static void wdDoModifyView(

IPrivateWork wdThis, IPrivateWork.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime) {

IWDTable table = (IWDTable) view.getElement("CustomerTable");

wdContext.currentContextElement().setCustomerTableSorter(

new TableSorter(table, wdThis.wdGetSortCustomersAction(), null));

}

//@@end

}

Former Member
0 Kudos

Hi,

i did in the same way you said,i think the problem is with TableSorter.java

Is it pre-defined java class or we have to write the code

<b>You just have to use the first constructor which does not have the String array parameter (IDs of sortable columns).</b>

i didnt understand this..can u explain me deatliy where i have to modify my TableSorter.java to sort my Tbale coulms

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Padma

this blog wil help you understand the coding involved

/people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter

Regards

Abhimanyu L

Former Member
0 Kudos

create <Sort> action and bind this to onSort property of the table.

wdContext.currentContextElement().get<Sort>().sort(wdEvent, wdContext.node<>());

http://help.sap.com/saphelp_erp2005/helpdata/en/93/6ce9403070712ae10000000a155106/frameset.htm

/people/peter.vignet/blog/2007/01/03/generic-web-dynpro-java-table-filter

Former Member
0 Kudos

Hi,

i just copied TableSorter.java in my project.But the colums in the table are not getting sorted.and the code i added to my view is


 public static void wdDoModifyView(IPrivateResultView wdThis, IPrivateResultView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
	if(firstTime)
		{
			IWDTable table=(IWDTable)view.getElement("Table");
			wdContext.currentContextElement().setTableSorter( new TableSorter(table,wdThis.wdGetSortAction(),null));
		}
    //@@end
  }

public void onActionSort(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSort(ServerEvent)

wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.nodeMatrl_List());

//@@end

}



Should i need to make any changes to TableSorter.java

Former Member
0 Kudos

no changes to tablesorter.java..........it z a special class which provides this function

Former Member
0 Kudos

Hi Padma,

This is the code u have to write in wdDoModifyView:

public static void wdDoModifyView(

IPrivateWork wdThis, IPrivateWork.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime) {

IWDTable table = (IWDTable) view.getElement("CustomerTable");

wdContext.currentContextElement().setCustomerTableSorter(

new TableSorter(table, wdThis.wdGetSortCustomersAction(), null, new String[] { "CustomerTable_Name" }));

}

//@@end

}

here table is ur table name and the string array u r passing ,in that ur column names should be available. U r not passing any column in that.So it will not show any sort icon itself.

Check this url for further info;

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

regards

Sumit

Former Member
0 Kudos

Padma ji,

If ur problem is solved,close the thread.

regards

Sumit

Former Member
0 Kudos

Sorri Sumit,

I dont know how to close a thread...tell me in simple steps..

Former Member
0 Kudos

Hi Padma,

Its same what u did with this thread :

When u get a reply ,u will get something like this in left side of the answer

Posts: 475

Questions: 42

Registered: 8/8/06

Forum points: 558

Unassign

Solved problem (10)

Very helpful answer (6)

Helpful answer (2)

U can click on solved problem radio button for closing the thread

regards

Sumit

Former Member
0 Kudos

Hi Sumit,

ok i will do...

Answers (0)