cancel
Showing results for 
Search instead for 
Did you mean: 

Add new column in the dynamic table.

Former Member
0 Kudos

HI Experts,

I have a dynamic table which contains 30 columns.Apart from these column,I want to add 1 more column of my own at the beginning of the table

Please suggest me .

Regards

-Sandip

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use the following code to add your column to the beginning.



  //Your existing table
	  IWDTable table = (IWDTable)view.getElement("Table");
	  IWDTableColumn tableColumn = (IWDTableColumn)view.createElement(IWDTableColumn.class);
	  //use the following if you are on old version
	  table.addColumn(tableColumn, 0);
	  //use the following in CE
	  table.addGroupedColumn(tableColumn, 0);

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Vinod V,Ayyapparaj KV,

Thank you for your helpful code.

Marks given to u both.

Regards

-Sandip

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello sandip,

One change in code


IWDTable table_all = (IWDTable)view.getElement( "Table");
table_all.addColumn( (IWDTableColumn)view.createElement( IWDTableColumn.class, 0);
// The last value would be the index of the column that comes in table

Thanks Armin for notifying my mistake.

Regards

- Vinod V

Former Member
0 Kudos

Still wrong

Armin

Former Member
0 Kudos

HI Vinod,

The problem has been resolved.This is how I added a blank column in my dynamic table.

Its working fine.

.....................................................

// Add a blank column at the beginning of the table

column = (IWDTableColumn)view.createElement(IWDTableColumn.class, null);

caption =(IWDCaption)view.createElement(IWDCaption.class, null);

editor.bindText("calculation_col.Zzgrpnr_calculate");

caption.setText("New Blank Column");

column.setHeader(caption);

editor = (IWDTextView)view.createElement(IWDTextView.class, null);

column.setTableCellEditor(editor);

table.addColumn(column,0);

.......................................................

Regards

-Sandip

Former Member
0 Kudos

Slightly better would be to use the generated constant I<Node>Element.<ATTRIBUTE_NAME> instead of the string literal. Then you are safe against renaming of context attributes.

Armin

Former Member
0 Kudos

Hi Armin,

Thank you very much for this valueable information.

I will take care hence forth.

Marks given to you.

Regards

-Sandip

Former Member
0 Kudos

Hello sandip,

Try this code


IWDTable table_all = (IWDTable)view.getElement( "Table");
table_all.addColumn( new IWDTableColumn(), 0);
// The last value would be the index of the column that comes in table

Regards

- Vinod

*

Former Member
0 Kudos

Please don't post wrong code.

Armin