on 09-20-2006 11:18 AM
Hi,
Can any one tell how to create dynamic table in Web DynPro through java Programming.
Thanks,
Ashvitha j.
Hi Karthikeyan,
I have tried your code.The last object shouldnot be 'test' it should be 'rootElement'.And in my requirement action tab is not reqired so I have not created any Action.But I am still getting internal server error.Anything need to add.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashvitha
It is very late reply...I was getting also same problem.This error is because of Caption..If u comment that caption whole line then ur programm will run but without column name .My NWDS version is 7.0.0.Here the caption is not taking. is showing Internal Server Error.If u deploy in different version NWDS then it will definitely work.Just check.
Suman
Hi,
Have look at the following sample code. and try it with your own data. this will create a table and context node and attributes for that table dynamically.
IWDTransparentContainer rootElement = (IWDTransparentContainer)view.getRootElement();
IWDNodeInfo tabNode=wdContext.getNodeInfo().addChild("Tab_Node",null,true,true,true,false,true,false,null,null,null);
IWDAttributeInfo tabAttrib_Name=tabNode.addAttribute("Name","ddic:com.sap.dictionary.string");
IWDAttributeInfo tabAttrib_Add=tabNode.addAttribute("Address","ddic:com.sap.dictionary.string");
IWDTable tab=(IWDTable)view.createElement(IWDTable.class,"Dyntable");
IWDAttributeInfo attrib1=tabNode.getAttribute("Name");
IWDAttributeInfo attrib2=tabNode.getAttribute("Address");
tab.bindDataSource(tabNode);
tab.setCompatibilityMode(WDTableCompatibilityMode.AUTO);
tab.setDesign(WDTableDesign.ALTERNATING);
IWDTableColumn tabColumn1=(IWDTableColumn)view.createElement(IWDTableColumn.class,"NameCol");
IWDTableColumn tabColumn2=(IWDTableColumn)view.createElement(IWDTableColumn.class,"AddressCol");
IWDCaption nameCap=(IWDCaption)view.createElement(IWDCaption.class,"nameCap");
nameCap.setText("Name");
tabColumn1.setHeader((IWDCaption)nameCap);
IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
addCap.setText("Address");
tabColumn2.setHeader((IWDCaption)addCap);
IWDInputField nameText=(IWDInputField)view.createElement(IWDInputField.class,"nameText");
nameText.bindValue(attrib1);
tabColumn1.setTableCellEditor((IWDTableCellEditor)nameText);
IWDInputField addText=(IWDInputField)view.createElement(IWDInputField.class,"addText");
addText.bindValue(attrib2);
tabColumn2.setTableCellEditor((IWDTableCellEditor)addText);
tab.addColumn(tabColumn1);
tab.addColumn(tabColumn2);
tab.createLayoutData(IWDRowHeadData.class);
tab.setWidth("300");
IWDNode dynTabNode=(IWDNode)wdContext.getChildNode("Tab_Node",0);
for(int i=0; i<5;i++)
{
IWDNodeElement dynTabElem=(IWDNodeElement)dynTabNode.createElement();
dynTabElem.setAttributeValue("Name","Karthik");
dynTabElem.setAttributeValue("Address","Chennai");
dynTabNode.addElement(dynTabElem);
}
rootElement.addChild(tab);
// you should create one action for the table lead selection
IWDAction tabact=(IWDAction)wdThis.wdGet<Actionname>();
tab.setOnLeadSelect(tabact);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.