cancel
Showing results for 
Search instead for 
Did you mean: 

How to add table component at runtime in the Java Web Dynpros

Former Member
0 Kudos

Hi

I have a requirement to generate TABLE component with 6 coumns with more than one rows at runtime.

So please send me the code how to generate table at runtime.

Help me ASAP

Thanks

venkat

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member485701
Active Participant
0 Kudos

Hi ,

The last reply solves your problem of creating the table at runtime with some columns.

If want to create some element in this.

(1)1st create the node in the context.

NodeInfo= wdContext.getNodeInfo().addChild(

displayName, null, true, CMICardinality.MANY,

you can create attributes in this manner. CMICardinality.MANY, false, null);

(2)backupNodeInfo.addAttribute("attr","com.sap.dictionary.string");

Now you can bind it with table and use it.

Regards,

Praveen

Former Member
0 Kudos

Hi Venkata

You have to do the coding in the doModifyView() method

The code wud look smthing like this

IWDTable table = (IWDTable)view.createElement(IWDTable.class,null);

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

table.bindDataSource(nodeInfo);

table.setDesign(WDTableDesign.STANDARD);

Iterator i =nodeInfo.iterateAttributes();

for(;i.hasNext();){

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

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

IWDAttributeInfo _attr = (IWDAttributeInfo)i.next();

caption.setText(attr.getName().toUpperCase());

column.setHeader(caption);

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

textView.bindText(attr);

column.setTableCellEditor((IWDTableCellEditor)textView);

table.addColumn(_column);

}

table.setVisibleRowCount(-1);

In the above code, I have created a table , binded it to a value node, iterated the node for the attributes and binded them to the table columns.

setVisibleRowCount is the property for the no of rows. -1 value means automatically it will have the req no of rows.

I hope this solves your problem.

Regards

Avinash

Former Member
0 Kudos

There are several posts regarding this topic. Check this one out.

https://forums.sdn.sap.com/click.jspa?searchID=5983802&messageID=1398336

/Greg

Former Member
0 Kudos

Hi,

Dynamic Programming of Web Dynpro Applications

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de1...

Regards

Ayyapparaj.