on 10-17-2009 8:15 PM
Hi,
I wrote a web dynpro java application.
I created node programatically, and i created table programatically again.
When i bind node to table it gets error below
Thanks.
Error
WDRuntimeException: DataSource attribute of table not valid
My code is below
Code
Creating node
IWDNodeInfo rootNodeInfo = wdContext.getNodeInfo();
IWDNodeInfo DNode =
rootNodeInfo.addChild("DNode", null, true, false, true, false, false, true, null, null, null);
DNode.addAttribute(
"BLM",
"ddic:com.sap.dictionary.string");
DNode.addAttribute(
"PER",
"ddic:com.sap.dictionary.string");
IWDNode node = wdContext.getChildNode("DNode", 0);
IWDNodeElement element = node.createElement();
element.setAttributeValue("BLM", "qwerty");
element.setAttributeValue("PER", "cvbcvbcvb");
node.addElement(element);
Binding to a table
IWDNodeInfo DNode = wdContext.getNodeInfo().getChild("DNode");
IWDTransparentContainer rootElement =
(IWDTransparentContainer) view.getRootElement();
IWDTable DTablo =
(IWDTable) view.createElement(IWDTable.class, "DTablo");
DTablo.bindDataSource(DNode); //error here
IWDTableColumn col1 =
(IWDTableColumn) view.createElement(
IWDTableColumn.class,
"BLM");
IWDTextView txtw1 =
(IWDTextView) view.createElement(IWDTextView.class, "BLMTX");
txtw1.bindText("DNode.BLM");
IWDTableCellEditor cled1 = txtw1;
col1.setTableCellEditor(cled1);
DTablo.addColumn(col1);
DTablo.setVisibleRowCount(20);
rootElement.addChild(DTablo);
I defined the node and table creation codes inside the wdDoModifyView and delete from contoller.
It runs properly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I used this code and it is working fine. I am using 7.0 SP 14.
wdDoInit()
{
IWDNodeInfo rootNodeInfo = wdContext.getNodeInfo();
IWDNodeInfo DNode =
rootNodeInfo.addChild(
"DNode",
null,
true,
false,
true,
false,
false,
true,
null,
null,
null);
DNode.addAttribute("BLM", "ddic:com.sap.dictionary.string");
DNode.addAttribute("PER", "ddic:com.sap.dictionary.string");
IWDNode node = wdContext.getChildNode("DNode", 0);
IWDNodeElement elem1 = node.createElement();
elem1.setAttributeValue("BLM", "blm1");
elem1.setAttributeValue("PER", "per1");
node.addElement(elem1);
IWDNodeElement elem2 = node.createElement();
elem2.setAttributeValue("BLM", "blm2");
elem2.setAttributeValue("PER", "per2");
node.addElement(elem2);
}
in wdDoModifyView(),
IWDNodeInfo DNode = wdContext.getNodeInfo().getChild("DNode");
IWDTransparentContainer rootElement =
(IWDTransparentContainer) view.getRootElement();
IWDTable DTable =
(IWDTable) view.createElement(IWDTable.class, "DTable");
DTable.bindDataSource(DNode); //*error here*
IWDTableColumn col1 =
(IWDTableColumn) view.createElement(IWDTableColumn.class, "BLM");
IWDTextView txtw1 =
(IWDTextView) view.createElement(IWDTextView.class, "BLMTXT");
txtw1.bindText("DNode.BLM");
IWDTableCellEditor cled1 = txtw1;
col1.setTableCellEditor(cled1);
IWDCaption header1 = (IWDCaption) view.createElement(IWDCaption.class,"HEADER1");
header1.setText("BLM");
col1.setHeader(header1);
DTable.addColumn(col1);
IWDTableColumn col2 =
(IWDTableColumn) view.createElement(IWDTableColumn.class,"PER");
IWDTextView txtw2 = (IWDTextView)view.createElement(IWDTextView.class,"PERTXT");
txtw2.bindText("DNode.PER");
IWDTableCellEditor cled2 = txtw2;
col2.setTableCellEditor(cled2);
IWDCaption header2 = (IWDCaption) view.createElement(IWDCaption.class,"HEADER2");
header2.setText("PER");
col2.setHeader(header2);
DTable.addColumn(col2);
DTable.setVisibleRowCount(10);
rootElement.addChild(DTable);
Can you give more details about the error?
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's certainly possible to create context structures and UI elements at runtime, create the data binding and fill the context elements etc. But: is this really needed for your use case? If for example your static context structure already contains all attributes you want to display in your table and you only want to display a subset of them at a time, it would be much easier to just hide the table columns that are not to be displayed etc.
Could you give some more info on the problem you want to solve?
Armin
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
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.