Skip to Content
author's profile photo Former Member
Former Member

Removing the dynamic attributes from view context

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Sep 27, 2006 at 06:50 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2006 at 04:17 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.