on 07-11-2005 3:26 AM
I am trying to do something similar to what was being asked about here: create a table at runtime without knowing how many or what columns there are in that table. I guess I don't understand the step where you 2. Create each attribute associated to a column (is this done programatically?). I can't figure out how to create and then add a value attribute to the context so that I can build the columns for the table. Is there anyone that can explain this better? Or point me to where I can see an example somewhere?
Thanks
you can programatically get the nodeinfo of the node to which you need to create the attribute and there just give addAttribute()
Then you can use it as your usual context attribute and set and get value.
wdcontext.node<nodename>().getattribute();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello
this code might help u.
to creat a node and attribute:
IWDNodeInfo node = wdContext.getNodeInfo().addChild("rootNode",null,true,false,true,true,true,true,null,null,null);
/** adding elements to rootNode */
node.addAttribute("name","com.sap.dictionary.string");
(this code can be written in doInit() or onAction().
to create colomns and celleditors:
// create table.
IWDTable table = (IWDTable)view.createElement(IWDTable.class,"mainTable");
table.bindDataSource("rootNode");
// create colomns
IWDTableColumn col = (IWDTableColumn) view.createElement(IWDTableColumn.class,"col1");
// set header
IWDCaption cap = (IWDCaption) view.createElement(IWDCaption.class,"cap1");
col.setHeader(cap);
cap.setText("Name");
// add colomn to the table
table.addColumn(col1);
// create cell editor and bind it to the node attribute.
IWDTextView textView1 =(IWDTextView) view.createElement(IWDTextView.class,"text1");
textView1.bindText("rootNode.name");
col.setTableCellEditor((IWDTableCellEditor)textView1);
this code u write in doModify();
to create elements:
IWDNode nodeIterate = wdContext.currentContextElement().node().getChildNode("rootNode",0);
IWDNodeElement element = nodeIterate.createElement();
nodeIterate.addElement(element);
element.setAttributeValue("name","Piyush");
regards,
Piyush.
You do not necessarily need to create or add context attributes at runtime. If you need to do that, use the context API (IWDNodeInfo, IWDAttributeInfo etc.)
Examples on how to build context structures at runtime may be found in the book "Inside Web Dynpro for Java" by Chris Whealy.
Perhaps you can give more details on your use case.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.