on 04-16-2013 4:39 PM
Hi good morning, I need to create a dinamic table, I have to make a WebDynpro happened where the number of columns and make the table.
Thanks & Regards
Cristian
Hi Cristian,
There number of documnets available. Anyway I am trying to give an idea or guide how can you generate table at runtime. Please follow the bellow lines and try to understant the logic and then apply for your scenario.
------------------------------------------------------------------------------------------
First fill/get the data you want to fill in table.
Now go to your view and wdDoModifyView() and write the in
below way.
if (firstTime){
// ref to root context node of view
IWDTransparentContainer con = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
// Create and add label to root UI element for table
IWDLabel label1 = (IWDLabel) view.createElement(IWDLabel.class , "label1");
label1.setText("Summary Report:");
con.addChild(label1);
//create table at runtime with cardinality 1
//IWDNodeInfo nodeInfo =
wdContext.getNodeInfo().addChild("TableNode",
null,true,true,false,false,false,true,null,null,null);
//create table at runtime with cardinality n
IWDNodeInfo
nodeInfo = wdContext.getNodeInfo().addChild("TableNode",
null,
true,
false,
true,
false,
false,
true,
null,
null,
null);
//now suppose you have filled your data in wdDoint()
of view or Comp
//controller. The node is “data” node. And the data node has
one attribute
//column name. and has 1 value in runtime. So you want to create
1 column
//in table at runtime.Run a for loop for the number of values in the “data”
//node. Colcount holds the size or number how many column you want to
//create
for(int i=0;i<colcount;i++){
IWDAttributeInfo
attInfo = wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).getNodeInfo().addAttribute("Status","ddic:com.sap.dictionary.string");
//suppose the column Name is Status in our case and
now we want to fill
//value/row from context node to table at runtime. You can
use one more for
//loop hare to fill row data in table.
for (int i=0; i<rowcount; i++){
IPrivateTestView.IReportTableElement
telem=tnode.getReportTableElementAt(i);
// ////// Fill value to the attribute at runtime
IWDNode
node_d = wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION);
IWDNodeElement node_d_e = node_d.createElement();
node_d_e.setAttributeValue("Status",telem.getStatus());
node_d.addElement(node_d_e);
//Creating table header text
IWDTable table = (IWDTable)view.createElement(IWDTable.class,"Table1");
IWDTableColumn
nameColumn = (IWDTableColumn) view.createElement(IWDTableColumn.class, "column");
IWDCaption
colHeader = (IWDCaption)view.createElement(IWDCaption.class,"header");
IWDTextView textView = (IWDTextView)view.createElement(IWDTextView.class , "text");
colHeader.setText("Status");
nameColumn.setHeader(colHeader);
textView.setText("");
textView.bindText(wdContext.getChildNode("TableNode",IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("Status"));
nameColumn.setTableCellEditor((IWDTextView)textView);
table.addColumn(nameColumn);
}
}
}
--------------------------------------------------------------------------------------------
Thanks
Shankha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See the attached document as a starting point. You should learn how to search for content on SCN.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.