cancel
Showing results for 
Search instead for 
Did you mean: 

Removing the dynamic attributes from view context

Former Member
0 Kudos

Hi,

I have added an attribute dynamically using the following line of code in wdDoModifyView():

wdThis.wdGetContext().getContext().getRootNodeInfo ().addAttribute(<attributename>, <datatype>);

Now I want to remove the dynamically created attribute from the context.

Pls suggest me in this regard.

Regards,

Ramesh.

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Ramesh,

You can use the following code to remove the attribute dynamically:

Iterator itr = wdContext.node<NodeName>().getNodeInfo().iterateAttributes();

<i>// If the node where you are making these attributes is a context node then just do:</i>
// <b>wdContext.getNodeInfo().iterateAttributes()</b>, <i>for iterator</i>

while(itr.hasNext()){
	IWDAttributeInfo attrInfo = (IWDAttributeInfo)itr.next();
	attrInfo.remove();
}

This will solve your problem.

Regards

Pravesh

PS: Please consider rewarding points if helpful and solved.

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Ramesh,

From JavaDoc (https://media.sdn.sap.com/javadocs/NW04/SP12/webdynpro/com/sap/tc/webdynpro/progmodel/api/IWDNodeInfo.html)

<i>Node infos also provide a mean to dynamically add child nodes (there are different methods for unmapped, mapped and recursive nodes) or attributes (unmapped or mapped, several methods to add attributes automatically from external meta data). <b>You cannot remove such nodes or attributes afterwards, you can only reset the whole context to its initial state via IWDContext.reset(boolean).</b>

</i>

Best regards, Maksim Rashchynski.