cancel
Showing results for 
Search instead for 
Did you mean: 

Column Positioning in a table

Former Member
0 Kudos

Hi,

Iam working on customization of a table in Webdynrpo Java.This is not the column swapping functionality. Its a positioning of the column.The column names are to displayed along with the position of the columns. When I select a particular position for a column, the column should appear in that position.For example:-

In my table, the column XXX is positioned at 5th and I want to change the position of the column XXX in the same table to 2nd position(not swaping,its positioning)

Can anyone guide me how to do this?

Hope i made my requirement clear.

Regards,

Padmalatha.K

Points will be rewarded.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ayyaparaj,

IWDTable table;

table.removeGroupedColumn(index);

table.getGroupedColumn(index);

table.addGroupedColumn(groupedColumn, index)

-


Im not getting the method called "removeGroupedColumn" in my NWDS.I m using NWDS 2.0.

Do i need to import anything tio get this method.

I am able to remove column from the Table.But I m not able to add it in the proper position in the table.

I am removing the column like this:-

table.removeColumn(34);

And I am trying to add the same column in perticular position like this:-

table.addColumn(column, index);

I m struck in here.

Please suggest how to pass the parameter

In the above code in Line 4,Can you please specify what is the first parameter "groupedColumn" ?And how do u pass the parameter.

Can you please send some more code on this?

Regards,

Padmalatha.K

Former Member
0 Kudos

Hi,

As you are working with an older version you can use the following


IWDTableColumn tableColumn = (IWDTableColumn)view.getElement("");
	  IWDTable table;
	  int index = 0; 
	  table.removeColumn(index);
	  table.getColumn(index);
	  table.addColumn(tableColumn, index);

Regards

Ayyapparaj

Answers (7)

Answers (7)

Former Member
0 Kudos

Than Q Ayyaparaj,

The issue is resolved.Thanks a lot again.Full marks.

Former Member
0 Kudos

Hi Ayyaparaj,

The approach which you have mentioned is correct,

But I have around 50 column in my table.Removing all the columns and adding them all according to positions is not possible.

Is there any other way that we can work on?

Means is ther any sap inbuilt method to position the columns in the table.

Regards,

Padmalatha.K

Former Member
0 Kudos

Hi,

You can make use of the following methods if you dont want to remove the entire one and do.


IWDTable table;
	  table.removeGroupedColumn(index);
	  table.getGroupedColumn(index);
	  table.addGroupedColumn(groupedColumn, index)

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyaparaj,

This is my requirement:

I have an application which has a table. This table contains 5 columns say A,B,C,D,E in the same order.

Below the table, i have a customize button.This button is used to customize the table.

When i click on this button a window should open up which will have the column names listed along with a dropdown .

The dropdown will have 1,2,3,4,5 as the values. When i select 3 from the dropdown(For positioning) for the column A ,then the column A should be shifted to 3rd position.

Please help me how to proceed for this.

Please give your mail id so that i can explain my requirement properly.

Regards,

Padmalatha.K

Former Member
0 Kudos

Hi,

Following is one of the approach

Hope you have the corresponding context attributes which stores the values of the dropdown

create a context attribute of type boolean lets say "RearrangeCols" initially set this to false

when the customize button is pressed or else if you have an apply(OK) button as part of the window. assing the context attribute "RearrangeCols" to true.

in wdDomodify check if this attribute is true.

Then remove all grouped colums and start adding them based on the condition specified by the user.

Ex:



boolean columnAlignChangeNeeded = wdContext.currentContextElement().getRearrangeCols();
	  if(columnAlignChangeNeeded)
	  {
		  IWDTable table  = (IWDTable)view.getElement("Your Table");
		  table.removeAllGroupedColumns();
		  //Add your colums based on user selection
// get the columns
		  table.addGroupedColumn(groupedColumn);
	  }

regards

Ayyapparaj

Former Member
0 Kudos

Hi Ashok,

Table is already created dynamicaly and i have a personalize button in this table.In this customize button to customize the table. I have to put the functionality like this:-

I have a table (static/Dynamic)with 5 columns say in the order A,B,C,D,E.

In the functionality button, I have to change the position to B,A,D,C,E

.After that when I click OK button,the changes should be reflected in the table(Static/Dynamic) in the order B,A,D,C,E.

This is not swapping.This is positining the column in the table.

Please suggest me how to do this.......

Regards,

Padmalatha.K

Former Member
0 Kudos

Hi,

If i am in track with your requirement

What comes to my mind right now is you can have a check in the wdDomodify and realing the cols based on a condition.

Ex:


if(columnAlignChangeNeeded)
	  {
		  IWDTable table  = (IWDTable)view.getElement("Your Table");
		  table.removeAllGroupedColumns();
		  //Add your colums based on user selection
		  table.addGroupedColumn(groupedColumn);
	  }

Regards

Ayyapparaj

Former Member
0 Kudos

Hi PadmaLatha,

From what I have understood ,you want to position a column dynamically based on where the user wants to see the column.You may capture this position as an input from user.

You should be able to do this by data binding dynamically on the table.The logic should offcourse be behind it it depending on user input/selection.

Many Thanks,

Ashok

Former Member
0 Kudos

hi,

Suppose you have one table called "TABLE" and you have 5 columns, A, B,C,D,E in this order and you want to set the position as A,B,E,C,D. To do this , in the OUTLINE of the view layout, right click on Table column E and select "MOVE UP" . It moves above D, then Apply the same methos again to get the desired location. Follow the method, to get the desired position of your table columns, Any further queries, Please write back...

Award points in helpful

Former Member
0 Kudos

.

Edited by: Vinod V on Mar 11, 2008 1:11 PM