cancel
Showing results for 
Search instead for 
Did you mean: 

ContextException: Unknown child node 0

Former Member
0 Kudos

Hi all,

Im creating tabstrip and table dynamically. I created one value attribute(integer type) for inputfield.I will enter number of columns in input field.I binded this attribute to inputfield.

While deploying getting this exception :

com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DynamicTabstripView): unknown child node 0

I wrote this code

IWDTabStrip tabstrip = (IWDTabStrip)view1.createElement(IWDTabStrip.class,"TabStrip");

IWDTab tab = (IWDTab) view1 .createElement(IWDTab.class, "tab");

IWDCaption headerCaption = (IWDCaption)view1.createElement(IWDCaption.class, "HeaderCaption");

headerCaption.setText("Edit");

tab.setHeader(headerCaption);

tab.setVisible(true);

tabstrip.addTab(tab);

IWDTransparentContainer root = (IWDTransparentContainer)view.getRootElement();

IWDTable table = (IWDTable)view1.createElement(IWDTable.class,"TD");

table.bindDataSource(nodeInfo);

table.setVisible(WDVisibility.VISIBLE);

root.addChild(table);

tab.setContent(root);

root.addChild(tabstrip);

IWDLabel label = (IWDLabel) view1.createElement(IWDLabel.class, "lbl");

label.setText("Enter name");

root.addChild(label);

IWDInputField input = (IWDInputField)view1.createElement(IWDInputField.class, "input" );

input.bindValue("" + wdContext.currentContextElement().getInputattr());

input.setEnabled(true);

input.setLength(20);

root.addChild(input);

can anyone give the answer.

Regards

Shirisha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This code looks strange. Where do you wrote it, inside wdDoModifyView()? And where do you get the reference to view1?

Armin

Former Member
0 Kudos

Hi,

Thanks for reply.

I wrote the code in wdModifyview() only. I got reference view1 from view. I declared view in at the end of code

//@@begin others

public static com.sap.tc.webdynpro.progmodel.api.IWDView View1;

//@@end

B'coz im using view1 in action code also, that's why i am taking reference from view.

Regards

Shirisha

Former Member
0 Kudos

Hi,

Dont store the views for later use this will crash in case of a clusterd system.

You can make use of context variables to set the readonly/ Visibility and for most of the properties.

I guess you are storing the handle of view to set some properties.

Try to use context attributes in WD. That is the recommended way of implementation

Regards

Ayyapparaj

Answers (2)

Answers (2)

former_member485701
Active Participant
0 Kudos

Hi,

I got the bug in your code.

tab.setContent(root);

In IWDTab you are adding the root transparent container as a content, which is wrong.

Because this is the root container.

you should use different container for this.

(1)create a new container.

IWDTransparentContainer container = (IWDTransparentContainer)view.createElement(IWDTransparentContainer.class, "con");

(2)Now add this container in the Tab.

tab.setContent(container);

Regards,

Praveen

Former Member
0 Kudos

Hi,

Can you post the code from where you get the nodeInfo

table.bindDataSource(nodeInfo);

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Thanks for reply.

I am posting the code

IWDNodeInfo nodeInfo = (IWDNodeInfo)wdContext.nodeTableNode().getNodeInfo();

IWDTable table = (IWDTable)view1.createElement(IWDTable.class,"TD");

table.bindDataSource(nodeInfo);

table.setVisible(WDVisibility.VISIBLE);

root.addChild(table);

tab.setContent(root);

root.addChild(tabstrip);

//Label and Input field to enter no.of col's

IWDLabel label = (IWDLabel) view1.createElement(IWDLabel.class, "lbl");

label.setText("Enter name");

root.addChild(label);

IWDInputField input = (IWDInputField)view1.createElement(IWDInputField.class, "input" );

// int n = wdContext.currentContextElement().getInputattr();

IWDMessageManager msgMgr1 = wdThis.wdGetAPI().getComponent().getMessageManager();

msgMgr1.reportSuccess("In input attribute" );

input.bindValue("" + wdContext.currentContextElement().getInputattr());

input.setEnabled(true);

input.setLength(20);

root.addChild(input);

//Button and Action

IWDButton button = (IWDButton)view1.createElement(IWDButton.class, "button1");

IWDAction action = wdThis.wdGetClickAction();

button.setText("Enter");

button.setOnAction(action);

Regards

Shirisha

Former Member
0 Kudos

Hi,

Try Repair project structure and Class path by right clickin gon your project and redeploy the application

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Thanks for reply.

I repaired project and class path. But getting same error.

Thanks

Shirisha.

Former Member
0 Kudos

Hi,

Can you post the errot stack trace.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

i am posting error :

com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DynamicTabstripView): unknown child node 0

Thanks

Shirisha