cancel
Showing results for 
Search instead for 
Did you mean: 

Table Colums order at runtime

Former Member
0 Kudos

Hi all,

I have at design time a table with 3 colums in this order: A-B-C.

At runtime I need to order colums in other sequence, for example C-B-A.

some ideas?

Thanks

Andrea

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

the problem is that table is created at design time, not at runtime, so i can't use IWDTable.swapColums() because IWDTable don't exist...

Can I manipulate an element create at design time?

Thanks

Former Member
0 Kudos

It doesn't make any difference whether it is created during the the design time or runtime to access the elements during the runtime.

Add this code in <i>wdDoModifyView()</i>


//Get the container of the table. 
  IWDTransparentContainer cont = (IWDTransparentContainer)view.getRootElement();

  IWDTable tab = (IWDTable)cont.getChild(<Index_of_table>);
 
//Assuming that 'A' is the first column and 'C' is the third column.   
  tab.swapColumns(0,2);

Former Member
0 Kudos

UI elements created at design time can be accessed inside method wdDoModifyView(). This method has a parameter "firstTime" that indicates if this method is called for the first time after view creation. If you want to make one-time-changes to the view layout, put your code inside an if-statement like

wdDoModifyView(..., boolean firstTime, ..., IWDView view)

if (firstTime)
{
  // access Table by ID
  IWDTable table = (IWDTable) view.getElement("<tableID>");
  // swap columns 0 and 2
  table.swapColumns(0, 2);
}

Armin

arun_srinivasan
Contributor
0 Kudos

hi andrea,

u can change the order of column by using swapcolumns.for this u refer this link http://help.sap.com/saphelp_nw04/helpdata/en/0e/23b3c8b0a238439f664f73a04e6332/frameset.htm

This link also helpful to u this for sorting (temporary)https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on creating tables in web dynpro - 11_0_.htm

i hope this helps,

with regards,

Arun

Former Member
0 Kudos

Andrea,

Are you using NW 7.0?

If so, then check that all your columns are of new type GroupedColumn. 'cause it seema that you have a mix of new GroupedColumns and obsolete Column instances. And they are ordered in wired way

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos
IWDTable.swapColumns(i,j)
IWDTable.removeColumn(i)
IWDTable.addColumn(column,i)

Armin